Sign in to follow this  
Berion

[java] Java and OpenGL

Recommended Posts

Hello! I can program c++ and OpenGL/DirectX and I just started learning java. I used the tutorial at http://java.sun.com/docs/books/tutorial/index.html. Now I want to start using OpenGL, but I have some questions: What is JOGL/JSR-231/LJGL/Java3D? And what should use? Thanks for the help. Berion EDIT: What about glsl and cg?

Share this post


Link to post
Share on other sites
Quote:
Original post by Berion
Hello!

Now I want to start using OpenGL, but I have some questions:

What is JOGL/JSR-231/LJGL/Java3D?


Both JOGL and LWJGL are JNI bindings that allow you to call OpenGL directly in Java. They are similar in functionality, a little different in design.

JSR-231 is the Java Community Process Specification for JOGL. Before any API can become an official Java API, it has to go through the JCP. So all you need remember is that JSR-231 is just another name for JOGL.

Java3D is a high-level scenegraph API. It has both OpenGL and DirectX implementations, but does not expose either directly to the programmer. Java3D is middleware. Similar libraries are the JMonkey Engine (JME), Xith3D, and Aviatrix3D.

Quote:

And what should use?


Whatever you want.

Java3D, JME, Xith3D, and Aviatrix would save you a lot of work, allowing you to focus primarily on your game code. Xith3D, JME, and I believe Aviatrix all use either JOGL, LWJGL, or both.

Were you to go with raw OpenGL via LWJGL or JOGL, you would need to implement a lot yourself besides the game code -- resource loading, rendering, scene management, and so on. Some people prefer this route, others prefer using middleware. Whichever you prefer is entirely up to you.

Quote:

EDIT: What about glsl and cg?


What about them? Both JOGL and LWJGL expose them, via OpenGL extensions and also via the OpenGL 2.0 API. Java3D does not (currently) have support for custom shaders. I don't know about the other APIs.

Share this post


Link to post
Share on other sites
It depends a bit on what you want to do, but when I tried to use Java3D, it seemed to me that it was rather oriented towards PowerPoint presentations than game dev. It has lots of stuff to repeat a simple animation with spheres and sticks, for example, but you have to go through a lot of tricks to move arbitrary models around. Also, I found it rather slow, and the setup code is kind of un-intuitive. For me, at least, JOGL works much better.

Share this post


Link to post
Share on other sites
I would suggest sticking with JOGL or LWJGL. (I lean towards JOGL myself, but that is just because of a coin flip to get me going)

Main reason to go with an OGL binding is that you can learn OGL on Java, and it is basically the same to use with any other language (I forget what the differences are, too early to think, someone else want to post them?) You can also use a lot of examples for C++ OGL in Java with fairly minor changes apparently. I haven't really tried it yet, but maybe I will after exams just to see how things go.

And Java3D is something totaly different as far as I know, almost nothing you learn from it can carry directly to OGL/DirectX.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this