problem using GLContext

Hello everyone!

I recently decided to make a little 3D Java game using jogl. So I downloaded the current release JSR231 (not the nightly built) and tried to get started with the help of some tutorials and demos.

I soon noticed that all code examples use a line like


GLCanvas canvas = GLDrawableFactory.getFactory().CreateGLCanvas (glcaps);

The method CreateGLCanvas does not exist anymore in the current release but is replaced by createExternalGLContext. So I read through everything I could find about it (mainly the API) and tried to make it work like this, even without examples. I have to admit I am a rookie in 3D programming…

So I created some starting code like:


final GLCapabilities glcaps = new GLCapabilities();
GLCanvas glcanvas = new GLCanvas(glcaps);
final GLContext glcontext = GLDrawableFactory.getFactory().createExternalGLContext();

But when I try to make it run using eclipse I get an error message like:

Exception in thread "main" javax.media.opengl.GLException: Error: attempted to make an external GLContext without a drawable/context current

I guess I have to make the glcanvas the current one first, but I really have no idea how, could not find anything in the jogl API.

Any help would be greatly appreciated, also any hint about whether I should really use this current release or maybe an earlier one?

Thanks a lot in advance,
Eric

Please look at the jogl-demos source code for examples of how to use the current JSR-231 APIs.

Maybe I am a little dumb right now, but a code example is exactly what I am looking now for quite some time. Where do I find one that deals with the GLContext?

Cheers, Eric

Please just download the jogl-demos sources and look through them. Gears is the simplest. DualContext shows how to use the new GLContext APIs manually.

I am really sorry if I get on anyone’s nerves, but I still don’t know where to find those demos. On java-gaming.org I can’t find them. Anywhere else?

Eric

Have you tried http://www.google.com/search?hl=en&q=jogl+demos&btnG=Google+Search&meta=?