Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (686)
Games in Android Showcase (198)
games submitted by our members
Games in WIP (758)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Real Time?  (Read 1259 times)
0 Members and 1 Guest are viewing this topic.
Offline Jamison

Junior Devvie

We're all idiots in one way or another.

« Posted 2006-05-03 18:24:23 »

Hey all,

I'm having a bit of trouble getting started with Java 3D... I can get a BranchGroup to render and all, rotate a cube, etc. But after the scene is compiled (BranchGroup.compile()), I can't set the Transform3D object on my TransformGroup object. Here's my code:
import java.awt.*;
import javax.swing.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;

public class Test extends JFrame {
   TransformGroup cubeTG = new TransformGroup();

   public Test() {
      setSize(400, 300);

      GraphicsConfiguration gc = SimpleUniverse.getPreferredConfiguration();
      Canvas3D c = new Canvas3D(gc);

      BranchGroup scene = new BranchGroup();

      cubeTG.addChild(new ColorCube(0.4));


      SimpleUniverse su = new SimpleUniverse(c);


      while(true) {
         Transform3D t3d = new Transform3D();



   public static void main(String args[]) {
      new Test();
I recieve the following exception:
Exception in thread "main" Group: no
capability to set transform
        at Test.<init>(
        at Test.main(
If I can't set the transform on an object after the scene has been compiled, how can I render in real time (for 3D games...)?

I don't like you. Check out my site Smiley
Offline Breakfast

Senior Devvie

for great justice!

« Reply #1 - Posted 2006-05-03 22:36:54 »

You need to set ALLOW_TRANSFORM_WRITE as one of the attributes on your transformgroup before you compile it- basically compiling will allow Java3D to optimise your scene as much as possible, if it knows an object won't be moved it can perform some optimisations that it couldn't perform if the object will be moved, so you need to tell it ahead of time.

I wrote a tutorial on basic Java3D for games a few years back, I suspect it may be a little out of date by now but there will probably be some stuff there that is useful to you- you can find it here...
Offline Jamison

Junior Devvie

We're all idiots in one way or another.

« Reply #2 - Posted 2006-05-04 01:31:13 »

Alright! Thanks so much, Breakfast. It works just as I wanted it to. I'll have a look at your tutorial now too.

I don't like you. Check out my site Smiley
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

roseslayer (484 views)
2016-08-06 11:43:29

roseslayer (442 views)
2016-08-06 09:43:11

xTheGamerCodes (516 views)
2016-08-04 15:40:59

xTheGamerCodes (509 views)
2016-08-04 15:40:24

orrenravid (857 views)
2016-07-16 03:57:23

theagentd (934 views)
2016-07-11 14:28:54

Hydroque (1029 views)
2016-07-06 05:56:57

Hydroque (1020 views)
2016-07-03 08:52:54

GrandCastle (835 views)
2016-07-01 09:13:47

GrandCastle (640 views)
2016-07-01 09:09:45
Rendering resources
by Roquen
2016-08-08 05:55:21

Rendering resources
by Roquen
2016-08-08 05:52:42

Rendering resources
by Roquen
2016-08-08 05:50:38

Rendering resources
by Roquen
2016-08-08 05:49:53

Rendering resources
by Roquen
2016-08-08 05:32:39

Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!