JInternalFrame with GLJPanel

Hi,

In my application, I need to use a few JInternalFrame (JIF) and in each JIF I have a GLJPanel to display the required drawing. I’ve written a test program that will make JIF with GLCanvas or GLJPanel or JPanel depending on the selection. I encountered the following 2 problems :

  1. When JIF is in the Maximum state for GLJPanel, when iconized will get the following error message but no problem for GLCanvas and JPanel

java.lang.NullPointerException
at net.java.games.jogl.GLJPanel$4.run(GLJPanel.java:483)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

  1. When more than one JIF containing GLJPanel eg. JIFA and JIFB, clicking JIFA so that it is the active frame. The GLJPanel not shown; instead the java logo without any text is shown at the task bar. This problem also occurred when you Maximized or Restore the JIF. No such problem if you use GLCanvas. I found a workaround is to call ensureUpdate() for componentResized() and internalFrameActivated(). Am I doing the right thing in ensureUpdate() ?

I’m using jogl from the release builds 2005 1.1.1 July 12. My java is 1.4.2_08 running on XP. I would appreciate if some one could run my test (given in the attachment; some of the code is cut and paste from http://www.genedavissoftware.com/books/jogl/ljogl_ch1.html) and see whether they encounter the same problem as I did. Note : since I can’t attach *.java file, I’ve renamed them to *.txt.

Thank You.

Thanks for tracking down these problems. I’m glad to be able to tell you that both appear to be fixed in the new JSR-231 branch of the JOGL tree. We hope to release a first version of this branch within a couple of weeks. The APIs have changed slightly, but in your application the only changes necessary would be to switch “import net.java.games.jogl.;" to "import javax.media.opengl.; import javax.media.opengl.glu.*;” and replace GLDrawable with GLAutoDrawable everywhere in your sources.

If you have the ability to build the JOGL tree you can check out the new branch with


cvs -d :pserver:guest@cvs.dev.java.net:/cvs co -r JSR-231 -P jogl jogl-demos

and build it by cd’ing to jogl/make and executing ant with the appropriate target (win32.vc6, win32.mingw, linux, etc.)

Thanks for the answer, how I wish I have the utilities to build the JOGL tree ! Looking forwards to the release; thanks again.

I’ve managed to build the jogl and modified my source accordingly. I’ve removed the ensureUpdate() from my componentResized() and internalFrameActivated(). I’ve tried for GLJPanel and it work fine. I then tried GLCanvas; I iconized the JInternalFrame (JIF) with GLCanvas, no problem. However when I deiconized the JIF, I got the following error :
javax.media.opengl.GLException: Unable to create OpenGL context
at com.sun.opengl.impl.windows.WindowsGLContext.create(WindowsGLContext.java:116)
at com.sun.opengl.impl.windows.WindowsGLContext.makeCurrentImpl(WindowsGLContext.java:141)
at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:74)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:79)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:117)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:207)
:
:

In actual application I don’t think people will put GLCanvas in JIF and have a few JIF since GLCanvas is heavy weight and JIF is light weight so the above problem shouldn’t happen !

You’re right, this is a new bug in the JSR-231 branch. Could you please file a bug with the JOGL Issue Tracker (you’ll need to be an Observer of the project) and attach your test case? Regardless, I’ll try to track this down.

I’ve modified the test program to include JIF with Canvas and filed a bug with the JOGL Issue Tracker as suggested. FYI it is under issue 176. Thank you for tracking this down.

Thanks for filing the bug. This was a Windows-specific regression introduced (embarrassingly enough, over two months ago) in the restructuring on the JSR-231 branch which split GLContext into separate GLDrawable and GLContext concepts. It’s been fixed in the JSR-231 branch.