Cannot create external context (swt + jogl 2)

Hi all,

I have a problem with createExternalGLContext on Jogl 2.0 for a swt application (packages org.eclipse.swt v3.5)

When I create an external context I have an error: attempted to make an external GLContext without a valid pixelformat

[quote]Exception in thread “main” javax.media.opengl.GLException: Error: attempted to make an external GLContext without a valid pixelformat
at com.sun.opengl.impl.windows.wgl.WindowsExternalWGLContext.create(WindowsExternalWGLContext.java:76)
at com.sun.opengl.impl.windows.wgl.WindowsWGLDrawableFactory.createExternalGLContext(WindowsWGLDrawableFactory.java:162)
[/quote]
I test also the snippet209 from jogl demo and I have the same error.
I use this (same as snippet209)

[quote]…
canvas.setCurrent();
final GLProfile gl2Profile = GLProfile.get(GLProfile.GL2);
GLDrawableFactory factory = GLDrawableFactory.getFactory(gl2Profile );
GLContext context = factory.createExternalGLContext();
[/quote]
In jogl 1.1 (without profil) it works:

[quote]…
canvas.setCurrent();
GLContext context = GLDrawableFactory.getFactory().createExternalGLContext();
[/quote]
An idea ?

Thanks

Please submit a bug report, I may encounter the same bug when I work with Eclipse RCP 3.5 and JOGL 2 in November.

I have also the same problem with swt 3.2.

Both 3.2 et 3.5 tests were on winxp.
I test the same programm and snippet on a linux version with swt 3.5 and it works.

Can I change the pixelformat before creating my external context ?

Juste found a solution (uncommon).

Just add WGL.GetDC(canvas.handle); (and import com.sun.opengl.impl.windows.wgl.WGL;)

In new version of Jogl (from jogamp) the code is not exactly the same:

And import com.jogamp.opengl.impl.windows.wgl.GDI;

Strange solution. Thank you for reporting this. You should write a bug report about this problem.