Swing application crashing when resizing OpenGL (GLJPanel) window.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Swing application crashing when resizing OpenGL (GLJPanel) window.

mikaelhc
Hi,

I'm still struggling with creating a stable code base for visualizing some scientific data (3D molecules).

Basically, I have a Swing application where I want to show some 3D graphics, driven by a FPSAnimator. All modifications to the data model and UI takes place in the EDT thread.

My troubles come when I start resizing the application.

I've previosly tried using a GLCanvas, but here I encountered the error described here:
http://forum.jogamp.org/GLCanvas-GLJPanel-problems-td4026923.html

So now I switched to GLJPanel, but occasionally I get crashes when resizing the application:

"Caused by: javax.media.opengl.GLException: Should not call this
        at jogamp.opengl.windows.wgl.WindowsWGLContext.getOffscreenContextPixelDataType(WindowsWGLContext.java:542)"

(Full stack trace here: http://pastebin.com/50VKHnTY)
       
In DEBUG mode I get slightly different errors:

When in debug mode, I can see that I always get some exceptions when resizing (but they do not seem to be critical):
java.lang.Exception: Info: setGL (OpenGL null): AWT-EventQueue-0, <null> -> GL4bcImpl, jogamp.opengl.gl4.GL4bcImpl@3cfaab
(Full stack trace here: http://pastebin.com/2tK342wd)

The critical errors (where the rendering stops working) displays these stack traces continously:
http://pastebin.com/sbEfXj63

(Startup information from debug mode here: http://pastebin.com/nGqYNwAq)

I'm *very* interested in workarounds for this: I guess it must be possible to create a simple embedded 3D view, where I can resize the window? Should I use a different approach? Using something else instead of the FPSAnimator to drive the animation? Should I go for JOGL 1.0 instead?

Best regards, Mikael.

System info: Jogl2.0-RC11 - Windows Vista 32-bit - Geforce 570GTX (Driver 9.18.13.697 (10-2-2012) - nvoglv32)
Reply | Threaded
Open this post in threaded view
|

Re: Swing application crashing when resizing OpenGL (GLJPanel) window.

gouessej
Administrator
Hi

mikaelhc wrote
Should I go for JOGL 1.0 instead?
JOGL 1 is no more maintained, completely outdated (it lacks a lot of fixes only present in JOGL 2.0) and we cannot even guarantee it would work on operating systems whose versions appeared after 2009. JOGL 1 is not a mythical bug-free creature ;)

mikaelhc wrote
I'm still struggling with creating a stable code base for visualizing some scientific data (3D molecules).
If you don't succeed in doing it, why not using Ardor3D? You would only have to modify your loader (if you use a particular file format for your molecules) and you would probably not have any problem with JOGL 2.0 except those caused by driver bugs. I worked in a subsidiary of the French institute of the petroleum, I visualized tons of scientific data with JOGL 2.0 in SWT & Swing applications, it's perfectly doable. If I don't find an easy way of fixing your stuff, why not using something higher level?

Edit.: Don't use a JSplitPane, try to use a GLCanvas in an AWT container, not directly a Swing component and it should work.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Swing application crashing when resizing OpenGL (GLJPanel) window.

mikaelhc
gouessej wrote
mikaelhc wrote
I'm still struggling with creating a stable code base for visualizing some scientific data (3D molecules).
If you don't succeed in doing it, why not using Ardor3D? You would only have to modify your loader (if you use a particular file format for your molecules) and you would probably not have any problem with JOGL 2.0 except those caused by driver bugs. I worked in a subsidiary of the French institute of the petroleum, I visualized tons of scientific data with JOGL 2.0 in SWT & Swing applications, it's perfectly doable. If I don't find an easy way of fixing your stuff, why not using something higher level?

Edit.: Don't use a JSplitPane, try to use a GLCanvas in an AWT container, not directly a Swing component and it should work.
Thanks for your answer, Julien.

The 3D engine itself is not the problem - I'm porting some existing C++/Qt/OpenGL code, so using pure OpenGL calls is perfect for me.

Following your suggestion, I tried nesting the GLCanvas inside a jawa.awt.Component and putting this into the JSplitPane. Amazingly, this works. I no longer get exceptions when resizing the views.

My only worry is, that before I could see my problems came because the OpenGL context was destroyed during the resize (dispose(GLAutoDrawable drawable) was called), and JOGL for some reason could not create a new context. Now the context is no longer called when resized, but can I be sure that the OpenGL context is not lost for other reasons?
Reply | Threaded
Open this post in threaded view
|

Re: Swing application crashing when resizing OpenGL (GLJPanel) window.

gouessej
Administrator
mikaelhc wrote
gouessej wrote
mikaelhc wrote
I'm still struggling with creating a stable code base for visualizing some scientific data (3D molecules).
If you don't succeed in doing it, why not using Ardor3D? You would only have to modify your loader (if you use a particular file format for your molecules) and you would probably not have any problem with JOGL 2.0 except those caused by driver bugs. I worked in a subsidiary of the French institute of the petroleum, I visualized tons of scientific data with JOGL 2.0 in SWT & Swing applications, it's perfectly doable. If I don't find an easy way of fixing your stuff, why not using something higher level?

Edit.: Don't use a JSplitPane, try to use a GLCanvas in an AWT container, not directly a Swing component and it should work.
Thanks for your answer, Julien.

The 3D engine itself is not the problem - I'm porting some existing C++/Qt/OpenGL code, so using pure OpenGL calls is perfect for me.
You're welcome.

mikaelhc wrote
Following your suggestion, I tried nesting the GLCanvas inside a jawa.awt.Component and putting this into the JSplitPane. Amazingly, this works. I no longer get exceptions when resizing the views.
Please mention it in your bug report too so that we keep a track of this workaround.

mikaelhc wrote
My only worry is, that before I could see my problems came because the OpenGL context was destroyed during the resize (dispose(GLAutoDrawable drawable) was called), and JOGL for some reason could not create a new context. Now the context is no longer called when resized, but can I be sure that the OpenGL context is not lost for other reasons?
That's a good question. The context can be destroyed when removing a GLCanvas from an AWT container.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Swing application crashing when resizing OpenGL (GLJPanel) window.

mikaelhc
gouessej wrote
mikaelhc wrote
Following your suggestion, I tried nesting the GLCanvas inside a jawa.awt.Component and putting this into the JSplitPane. Amazingly, this works. I no longer get exceptions when resizing the views.
Please mention it in your bug report too so that we keep a track of this workaround.
I will - but I need to do some more testing (on more machines), before I am sure the exceptions are completely gone.

gouessej wrote
mikaelhc wrote
My only worry is, that before I could see my problems came because the OpenGL context was destroyed during the resize (dispose(GLAutoDrawable drawable) was called), and JOGL for some reason could not create a new context. Now the context is no longer called when resized, but can I be sure that the OpenGL context is not lost for other reasons?
That's a good question. The context can be destroyed when removing a GLCanvas from an AWT container.
I'll try that out, to see if I can recreate the context loses.