Wow thank you! So the listener is not too complicated as I thought, I got it working now! Whoopieee!!
You really enlightment me Ken Russel! ;D
Guess I pick a wrong JOGL introduction at first… I’m too focus with that listener thing! 
This is it, the game (webstart) that using Java2D, JOGL, and LWJGL :
http://goldenstudios.or.id/products/games/bin/robosick.jnlp
Please tell me whether there are some mode that not working, it’s Java2D windowed/fullscreen bufferstrategy/volatile image, JOGL windowed/fullscreen, LWJGL windowed/fullscreen vsync/not
PS: my site server is frequently down recently, if the connection failed/refused/reset please wait an hour or so before try it again, they upgrading the site server
Yippie now I have a working game engine that utilize Java2D <-> JOGL <-> LWJGL, anyone would like to try this bloody fantastic game library? ;D
The engine is designed specially to make 2D games only, using Java2D for the default and support/utilize the power of OpenGL via JOGL and LWJGL! Of course use OpenGL to get more fps if only the game still slow with Java2D 
So if anyone want to make 2D games that supporting OpenGL easily, you could try my game engine.
Anyway I have 4 questions (only one that important) :
-
what is setAutoSwapBufferMode(boolean onOrOff) do exactly?
Do I get more performance if I turn it off and do the swapBuffers() manually?
Got any tips for me to do optimized 2D rendering with JOGL?
-
What is gl.glFlush(); I set it in display(GLDrawable drawable), got it from sample code.
Right now my display(GLDrawable drawable) function is empty, only call the gl.glFlush(); but I see no difference if remove it??
public void display(GLDrawable drawable) {
// flush the graphics commands to the card
gl.glFlush();
}
-
Is the rendering automatically synchronize with vsync?
Cos I set the rendering should be at maximum fps and I got only 75 fps, and I’m sure it should be not that low, cos I got 260 fps with Java2D
Is there anyway I can disable the vsync? Not too necessary though, only for showing the max fps the game can game using JOGL.
-
And the last, the irritating one, I got this exception :
java.lang.NoClassDefFoundError: net/java/games/jogl/GLEventListener
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at com.golden.roboticswar.RoboticsWarGame.main(RoboticsWarGame.java:168)
The exception thrown when I’m not including the JOGL library (jogl.jar).
JOGL library not needed when someone want only making Java2D game or LWJGL game, so they won’t include JOGL library.
But when the JOGL library is not included, even the game not touching the JOGL API directly, but still there is JOGL API inside the class, but not touched, it’s in another function that never be called if the game not using JOGL, that exception is thrown 
This method is working for LWJGL, if the game only use one of JOGL or Java2D, then the LWJGL library is removed, no exception is thrown.
Any thought about this? Anything to wrap with try catch? I have wrap the method that call JOGL API with try catch, but still not working 
Right now I’m using reflection to create the JOGL graphics engine class, it’s working, but I guess it’s pretty weird way to do it.
Once again thank you very much for the enlightment!! 