NewtCanvasSWT vs swt.GLCanvas

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

NewtCanvasSWT vs swt.GLCanvas

Celine
Hi,

How to use JOGL in an Eclipse RCP application?
I suppose the better way to do this is to use SWT canvas: no AWT/SWT mix, no SWT_AWT bridge (avoiding the problem described here)
I made some simple tests with com.jogamp.newt.swt.NewtCanvasSWT and com.jogamp.opengl.swt.GLCanvas (JOGL 2.0.2, Eclipse Kepler, Windows 7 / RedHat 5.2) and I have some problems with both.

With NewtCanvasSWT:
- On Linux, popup menu attached to the canvas is not displayed
- On Windows, changing the cursor with “setCursor” method has no effect (maybe related to bug#582)
- No more rendering after detaching the editor from the main window, see bug#822

With swt.GLCanvas:
- On Linux, popup menu is displayed but stays visible (disappears if canvas is redrawn), same problem with tooltips displayed over the canvas
- I find no way to change GLCapabilities without disposing the canvas and creating a new one

The last mentioned problem with swt.GLCanvas is the most critical for me. I need to change the GLCapabilities to enable/disable the stereo or the multisampling. With NEWT, I just create a new GLWindow, no need to dispose the canvas.
Is it possible to add a way to change the OpenGL capabilities in swt.GLCanvas?
I didn’t test org.eclipse.swt.opengl.GLCanvas, do you think I should try it?
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasSWT vs swt.GLCanvas

Sven Gothel
Administrator
On 08/30/2013 06:58 PM, Celine [via jogamp] wrote:

> Hi,
>
> How to use JOGL in an Eclipse RCP application?
> I suppose the better way to do this is to use SWT canvas: no AWT/SWT mix, no
> SWT_AWT bridge (avoiding the problem described here
> <http://forum.jogamp.org/Problem-with-GLCanvas-in-Eclipse-RCP-application-td4027754.html>)
>
> I made some simple tests with com.jogamp.newt.swt.NewtCanvasSWT and
> com.jogamp.opengl.swt.GLCanvas (JOGL 2.0.2, Eclipse Kepler, Windows 7 / RedHat
> 5.2) and I have some problems with both.
>
> With NewtCanvasSWT:
> - On Linux, popup menu attached to the canvas is not displayed
> - On Windows, changing the cursor with “setCursor” method has no effect (maybe
> related to bug#582)
NEWT doesn't support this, yup.

> - No more rendering after detaching the editor from the main window, see bug#822
hmm ..

>
> With swt.GLCanvas:
> - On Linux, popup menu is displayed but stays visible (disappears if canvas is
> redrawn), same problem with tooltips displayed over the canvas
Interesting, we probably need to issue a refresh call to out GLCanvas,
which should have been propagated properly (natively) .. but obviously didn't.

> - I find no way to change GLCapabilities without disposing the canvas and
> creating a new one

That is a feature, i.e. none of our 'tools' can do that w/o re-creation.
How should it, when those caps also define the underlying framebuffer ?

>
> The last mentioned problem with swt.GLCanvas is the most critical for me. I
> need to change the GLCapabilities to enable/disable the stereo or the
> multisampling. With NEWT, I just create a new GLWindow, no need to dispose the
> canvas.
> Is it possible to add a way to change the OpenGL capabilities in swt.GLCanvas?
> I didn’t test org.eclipse.swt.opengl.GLCanvas, do you think I should try it?

You should walk the 're-create' route, i.e. change caps -> re-create the resource.

You may be able to safe the GLContext, so your GL states stay the same.
This is possible via the implemented GLStateKeeper interface
in GLWindow, allowing you to preserve the GL state.
We already use it for Android and NEWT native re-parenting (AWT, SWT).
So you could call setGLStateKeeperListener(true) before destroying your NEWT
resource, and then recreate it. The latter will reuse the saved GLContext.

Please load JOGL source code in your IDE .. and gather details via
'call-hierarchy' .. and the API doc.

~Sven


> Thanks.
>
>


signature.asc (911 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasSWT vs swt.GLCanvas

gouessej
Administrator
In reply to this post by Celine
Celine wrote
I didn’t test org.eclipse.swt.opengl.GLCanvas, do you think I should try it?
Celine, this OpenGL Eclipse SWT canvas hasn't been maintained since 2006, it is completely given up and is not a part of JogAmp APIs anyway.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasSWT vs swt.GLCanvas

Wade Walker
Administrator
In reply to this post by Celine
Celine wrote
I didn’t test org.eclipse.swt.opengl.GLCanvas, do you think I should try it?
That canvas is often reliable, but it's very basic -- there's no multisampling or stereo support.
Reply | Threaded
Open this post in threaded view
|

Re: NewtCanvasSWT vs swt.GLCanvas

Celine
In reply to this post by Sven Gothel
Sven Gothel wrote
> With NewtCanvasSWT:
> - On Linux, popup menu attached to the canvas is not displayed
> - On Windows, changing the cursor with “setCursor” method has no effect (maybe
> related to bug#582)
NEWT doesn't support this, yup.
Have you planned to add this feature?

Sven Gothel wrote
 
> The last mentioned problem with swt.GLCanvas is the most critical for me. I
> need to change the GLCapabilities to enable/disable the stereo or the
> multisampling. With NEWT, I just create a new GLWindow, no need to dispose the
> canvas.
> Is it possible to add a way to change the OpenGL capabilities in swt.GLCanvas?
> I didn’t test org.eclipse.swt.opengl.GLCanvas, do you think I should try it?

You should walk the 're-create' route, i.e. change caps -> re-create the resource.
I totally agree with that.
What I mean is re-create the drawable and GL context without disposing the canvas, something like:

public void changeGLCapabilities(GLCapabilitiesImmutable capsReqUser)
{
  this.capsRequested = capsReqUser;
  disposeOnEDTGLAction.run();
}

Then, next paint event will re-create the drawable and the context.
Do you think it could works? it could be a nice feature.
Thanks