JOGL without Swing

Hi,

I’d like to know how to use the GL without Swing. Not sure it’s possible but I’d like to get a GL without needing to make a GLCanvas, registering a GLEventListener etc.

I think JOGL2 is supporting this via NEWT. I haven’t looked at it too much yet, but that might be a starting point for you.

You will need some framework specific code to get a window to be displayed. And the GLEventListener is used to stableize GL calls over different platforms and drivers. If you don’t like the JOGL way of doing this, take a look at LWJGL.

Btw. why don’t you want to use GLCanvas and GLEventListener?

because I’m doing some GPGPU work which doesn’t need anything to actually appear on the screen. I wanted to do the work outside the AWT event thread if possible

maybe you can use PBuffers? - LWJGL should support PBuffers without any UI

the jogl1 way of doing headless rendering is by using a 1x1 pbuffer as drawable.
http://kenai.com/projects/netbeans-opengl-pack/sources/glpack-git/content/jogl-utils/src/com/mbien/engine/util/GLWorkerImpl.java?rev=a9edd697184288442d42c1509f1e118debbb8c1e

But afaik it will run on the EDT by default too (there are flags to change this behaviour but i never tried it).

For better control of threading I would recommend to take a look at JOGL2. (It is in general a good Idea to take a look at JOGL2 since jogl1 is in maintenance mode)

EDIT: or LWJGL :wink:

Yep … use Pbuffers …

http://download.java.net/media/jogl/jogl-2.x-docs/javax/media/opengl/GLDrawableFactory.html#createGLPbuffer(javax.media.opengl.GLCapabilities,%20javax.media.opengl.GLCapabilitiesChooser,%20int,%20int,%20javax.media.opengl.GLContext)

It’s X11 impl. e.g. creates a default connection to the default display/screen … then creates the
pbuffer drawable …