Re: Swing application crashing when resizing OpenGL (GLJPanel) window.
Posted by
mikaelhc on
Dec 10, 2012; 9:10am
URL: https://forum.jogamp.org/Swing-application-crashing-when-resizing-OpenGL-GLJPanel-window-tp4027441p4027463.html
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?