Hello,
I have an old application consisting of a SWT composite that contains four GLCanvas. This old application used to work with JOGL 1. I've ported it to JOGL 2 and almost everything is working fine. The problem comes when I change GLCanvas layout order. By calling moveBelow(Composite) method on these GLCanvas, the rendering is stopped ! I have no idea to solve the issue ;-( Any help would be very appreciated ? Thanks, frank PS : I'm far from being an OPENGL developer, which means that I am certainly misusing the OPENGL API Here is the code used to change layout : if (legendPosition != this.legendPosition) { if (legendPosition == SWT.TOP) legendArea.moveBelow(leftAxisArea); else legendArea.moveBelow(bottomAxisArea); legendArea.setVisible(true); showLegend = true; layout(true); this.legendPosition = legendPosition; } |
Administrator
|
Hi
I was doing something similar several years ago, I used SWT_AWT to put an AWT GLCanvas into a SWT Composite but I didn't use a StackLayout. I think that the rendering is stopped when the GLCanvas is no longer on the top which is the expected behaviour. However, in your case, you use Control.moveBelow(Control) which calls dispose() on the control passed as a parameter and its children. This is neither a bug nor a problem concerning JOGL. I can't be 100% affirmative but this has probably nothing to do with the switch from JOGL 1 to JOGL 2. If you want to avoid your canvas from being disposed, use another approach (maybe a StackLayout, a NEWT SWT canvas or JogAmp SWT OpenGL heavyweight canvas called GLCanvas too but in a different package).
Julien Gouesse | Personal blog | Website
|
This post was updated on .
Hi gouessej and thanks for your reply.
Don't think that calling control.moveBelow(controlParam) calls dispose() on controlParam : I've just had a look at SWT code and I've not seen any of this, hopefully : I wouldn't be happy if such a think could happen ! In other world, I don't think that any GLCanvas is disposed during this call. Why do you say something like that ? Have you seen it in SWT source ? |
Administrator
|
There are several developers claiming that some controls gets disposed when moved below another one on StackOverflow and anyway, if the GLCanvas becomes invisible, it can destroy its OpenGL context, this is a known limitation. Have you tried to use a StackLayout instead?
I have looked at the source code but this method isn't final, any class can override it: http://kickjava.com/src/org/eclipse/swt/widgets/Control.java.htm
Julien Gouesse | Personal blog | Website
|
This post was updated on .
Well... this is not a stack layout that I want to use ! I don't want to swap between several GLCanvas with topControl field of the stack layout because only one GLCanvas would be visible at a time. All of my GLCanvas are always visible and layered in a grid layout. All I want to do is to reorganize these GLCanvas positions using moveBelow() :
"Moves the receiver below the specified control in the drawing order. If the argument is null, then the receiver is moved to the bottom of the drawing order. The control at the bottom of the drawing order will be covered by all other controls which occupy intersecting areas." http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fwidgets%2FControl.html I'm not sure it is a SWT "issue" as it was not a problem with JOGL 1 and of course moveBelow method is working fine with standard SWT widgets. But I've not found any solution ;-( "There are several developers claiming that some controls gets disposed when moved below another one on StackOverflow" I Will have a look at that on StackOverflow. "If you want to avoid your canvas from being disposed, use another approach (maybe a StackLayout, a NEWT SWT canvas or JogAmp SWT OpenGL heavyweight canvas called GLCanvas too but in a different package)." I Will test NEWT and the other GLCanvas. thanks a lot, frank |
Administrator
|
It can still be a problem of interoperability, mixing AWT/Swing and SWT can be challenging. I hope that using a plain com.jogamp.opengl.swt.GLCanvas (without the SWT_AWT bridge) will be helpful in your case. It would be nice if you could run your application in debug mode and tell us which method of the GLCanvas is called after the use of moveBelow(). You're welcome.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |