Re: Swing application crashing when resizing OpenGL (GLJPanel) window.
Posted by
gouessej on
Dec 10, 2012; 12:25pm
URL: https://forum.jogamp.org/Swing-application-crashing-when-resizing-OpenGL-GLJPanel-window-tp4027441p4027465.html
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.