Reputation: 122620
I'm using Java3D and JOGL, but I'm having a hard time figuring out how to do this by looking at the javadocs. I want to load a .obj file (other formats would be nice, too) and render it using JOGL.
Here's a loader class. It returns a Scene from a filename. How can I use this Scene
in JOGL?
Thanks. I'm new to JOGL and Java3D.
Upvotes: 1
Views: 5598
Reputation: 4125
There is a OBJ loader using JOGL here: http://github.com/sgothel/jogl-demos/blob/master/src/demos/util/ObjReader.java
Upvotes: 2
Reputation: 34085
The Scene
object provides no access to triangles, which is what you would need to use in JOGL. In fact Java3D and JOGL are two very different libraries, and I wonder why you are using them both together (or how). Java3D is a scene graph API while JOGL is just a wrapper to low-level OpenGL. Are you aware of these things?
In any case, you'll need to write an OBJ loader for JOGL. It's not a hard task though! Just find some OBJ specs and write a loader which parses the file line-by-line into whatever format you choose to send to JOGL.
Or, stick with one of the two libraries. I see no sense in using both. Either you want to use low-level OpenGL, or you want the convenience of high-level Java3D, right?
Upvotes: 1