Hi,

I just tried updating an example Java3D program. Hello3d used to be five lines of code 
+ imports, main etc. and worked fine with both OpenGL and DirectX.

With the latest version of Java3D it takes twelve lines of code to do the same thing 
and no longer works on OpenGL (on my system, 
SimpleUniverse.getPreferredConfiguration() returns Null).

No big deal I suppose, but why is Java3D getting more complicated and less portable? 
Won't we put off a lot of potential users if all the existing example programs on the 
web begin failing with the "applet not inited" message ?

Code follows - if there is an easier new version please let me know (obviously  I 
could save a line or two by putting everything in main).

// old version
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.media.j3d.BranchGroup;
public class Hello3d {
public Hello3d()
{
   SimpleUniverse universe = new SimpleUniverse();
   BranchGroup group = new BranchGroup();
   group.addChild(new ColorCube(0.3));
   universe.getViewingPlatform().setNominalViewingTransform();
   universe.addBranchGraph(group);
}
public static void main( String[] args ) {
   new Hello3d();
}
} // end of class Hello3d



//----------------------
// new version
//----------------------
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.geometry.ColorCube;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.BranchGroup;
import java.awt.Frame;

public class Hello3d {
public Hello3d()
{
   Frame frame = new Frame();
   GraphicsConfiguration config =
 SimpleUniverse.getPreferredConfiguration();
   Canvas3D canvas = new Canvas3D(config);
   canvas.setSize(200,200);
   SimpleUniverse universe = new SimpleUniverse(canvas);
   BranchGroup group = new BranchGroup();
   group.addChild(new ColorCube(0.3));
   universe.getViewingPlatform().setNominalViewingTransform();
   universe.addBranchGraph(group);
   frame.add(canvas);
   frame.pack();
   frame.show();
}
public static void main( String[] args ) {
   new Hello3d();
}
} // end of class Hello3d

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to