Jump to content
  • Advertisement
Sign in to follow this  
Mastadex

OpenGL JoGL - need some info

This topic is 4814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, one of the projects i gotten myself into requires me to learn JoGL (java API that uses openGL). does anyone have any suggestions on books and/or online referenses that i can use to learn those API??

Share this post


Link to post
Share on other sites
Advertisement
All I can say is watch out for bugs. I did a fair amount of work with it last year, and you do have to bear in mind that jogl is a work in progress. There were some things ( which I don't recall details, sorry ), where I knew something was supposed to work, but it didn't, and after some time I found a page online specifying it was a known bug. Just be aware.

Share this post


Link to post
Share on other sites
Are there any 3D libaries/API that I could use instead of JoGL? Its a relatively small project that we want to run on both windows and linux. I also looked into jSDL as an alternative (if we decide to go the 2D route).

Share this post


Link to post
Share on other sites
They're pretty close to plain OpenGL. The difference being that the OpenGL functions are class methods, so you will see GL.glEnable(...) instead of just glEnable(...) and things like that.

Also, initialization is specific to associating a context with a canvas or widget, but those are standard platform-specific issues.

Other than that, it feels like OpenGL and you get used to adding the class prefixes pretty quickly.

Also, I believe that the updated Java 1.5 support in LWJGL allows you to get around using those prefixes, but I may be confused on that.

Share this post


Link to post
Share on other sites
yep, it's fully possible with LWJGL to use the static import feature new in Java 1.5, it's easy.

import static org.lwjgl.opengl.GL11.*;

...

{
glClear(...);
glLoadIdentity();
glEnable(GL_BLEND);

}




You get the idea :)

Also to mention, with JoGL this is much more difficult, and is actually completely different from traditional OpenGL in a major way: All of GL's functions aren't static. With JoGL, the programmer is responsible to make GL accessible from ANY object that renders. Like this:

public void display(GLDrawable drawable) {

float red = 0.0f;
float green = 0.0f;
float blue = 0.0f;

GL gl = drawable.getGL();

gl.glClear(GL.GL_COLOR_BUFFER_BIT);

...
}

Share this post


Link to post
Share on other sites
Great, ill pass this info on to the other members of the group (its a school project, else why would i be using Java?) and get their take on it.

Thanks for the info so far.

Share this post


Link to post
Share on other sites
I take semi-offense to the "why else" comment :) There's lots of great reasons to use Java, and the reality of the matter is: there are going to be many, many more in the future.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!