The Artima Developer Community
Sponsored Link

Java Answers Forum
Problem to display VRML file with Java3D and CyberVRML97

3 replies on 1 page. Most recent reply: Sep 1, 2003 12:36 AM by Grand Davy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Grand Davy

Posts: 3
Nickname: moquette
Registered: Aug, 2003

Problem to display VRML file with Java3D and CyberVRML97 Posted: Aug 29, 2003 2:15 AM
Reply to this message Reply
Advertisement
Good morning everybody,

Recently I have a small problem to display an 3D object from VRML file with Java 3D.

I load the data of VRML file with CyberVRML97's package and so I obtain an object "BranchGroup", usable with Java 3D classic. But when I try to display it in a classic frame, nothing appears. Here is my source code :

public class Viewer3 {

public static void main( String[] args ) {
Frame frame = new Frame();
frame.setSize(640, 480);
frame.setLayout(new BorderLayout());

Canvas3D canvas = new Canvas3D(null);
frame.add("Center", canvas);
SimpleUniverse u = new SimpleUniverse(canvas);
u.getViewingPlatform().setNominalViewingTransform();
// Loading of source file
VRML97Loader loader = new VRML97Loader();
loader.load("test2.wrl");
BranchGroup b = loader.getBranchGroup();
b.compile();
u.addBranchGraph(b);

frame.show();
}
}

I don't know if the error comes from the display or comes from the loading of VRML file. This last presents an object of the Shape3D class with an appearance and a Geometry ; the Geometry object is an IndexedTriangleArray.

If somebody has an idea about my problem, I am taker.
Ciao and thank you in advance !

Ps : if somebody has the source code of an example which use Java3D and CyberVRML97 to display an IndexedTriangleArray, I am taker also.


Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Problem to display VRML file with Java3D and CyberVRML97 Posted: Aug 31, 2003 8:04 PM
Reply to this message Reply
The line:
Canvas3D canvas = new Canvas3D(null);
is probably the problem.
It probably should be like:
//Find the preferred GraphicsConfiguration object for the system.
    GraphicsConfiguration graphicsConfiguration = SimpleUniverse.getPreferredConfiguration(); 
 
    //Create a Canvas3D using the preferred GraphicsConfiguration 
    Canvas3D canvas3d = new Canvas3D(graphicsConfiguration);
 

Grand Davy

Posts: 3
Nickname: moquette
Registered: Aug, 2003

Re: Problem to display VRML file with Java3D and CyberVRML97 Posted: Sep 1, 2003 12:29 AM
Reply to this message Reply
Thanks ! I will try now.

Grand Davy

Posts: 3
Nickname: moquette
Registered: Aug, 2003

Re: Problem to display VRML file with Java3D and CyberVRML97 Posted: Sep 1, 2003 12:36 AM
Reply to this message Reply
I tried your idea of solution, but it isn't the problem. I will continue to search, thanks again. If you're an other idea, send me. Ciao !

Flat View: This topic has 3 replies on 1 page
Topic: I need a Programmer to help our team Previous Topic   Next Topic Topic: JMagick documentation???

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use