Need GLContext?

Hi.

I have written an OpenGL engine for talking faces in Java using GL4Java,
and are now porting it to JOGL, because we want to use Java 5.

The problem is that my java engine is to be called from TCL, where TCL
creates the OpenGL context, and calls my engine to do the rendering.
In other words: I don’t want to create the GLCanvas the engine paints to in Java, but in TCL.

This worked just fine in GL4Java by loading the libraries and accessing
the GLFunc and GLUFunc using the GLContext object.

How can this be done in JOGL?

/Mikael

Currently this will be a bit of a hack but you can temporarily create a GLCanvas, add a GLEventListener, make the canvas visible, and cause it to repaint until your GLEventListener.init() method gets called. Then hide the GLCanvas and use its GL object when your OpenGL context is current. This will be made a lot cleaner pretty soon.

Thanks for the reply!

Yes, I suspected that was the only way to do it currently.

Do you have some kind of redesign that would sort problems like this in the pipeline?

Right now we are looking into LWJGL, and have found a solution that works fairly well.
It’s more work though because I need JOGL’s ability to integrate with AWT, and
will have to write adapters for both systems as it seems…

Not to steal JOGLs thunder, but lwjgl supports awt via the AWTGLCanvas class

There is a rewrite in progress which will allow you to do what you describe in a specified and portable way. You can check out the “JSR-231” branch of the JOGL source tree to see the current state of the work. The GLContext class is present in this workspace although the specific functionality you want (creating a “no-op” context to interface to another library) is still being worked on.

There is a great demand fo such a feature, we have had this problem with customer wanting to integrate AgentFX into legacy code written C/C++. We actually have had plans to add this feature to a custom AgentFX build of JOGL.

Keep up the good work.

Cheers
// Tomas :slight_smile: