Areas


Topics

j3d.org

JOGL Advanced Issues

  1. where is makeCurrent()?
  2. pBuffer Initialisation Timing Problems
  3. Why don't I get GLEventListener callbacks when I use a custom render thread?

Return to the main FAQ page for more questions and answers.

 

1. where is makeCurrent()?

makeCurrent() is not available as part of the JOGL API set, along with a number of the other GLX/WGL/AGL calls. There is ongoing debate within the JSR process about exactly how much of these calls should be exposed to the end user. The most frequent response has been that AWT provides a lot of synchronisation problems between the native rendering, the AWT peers (and by association, Swing), with the GL rendering context management.

If your application needs to do stuff with the GL context that is not part of the normal rendering loop, such as load textures and shaders, there are two possible alternative approaches. Firstly, rearchitect the application to shift the resource loading down into the render loop (display() callback from GLEventListener) to process them at the start of every frame. Secondly, create a zero-sized, undecorated Frame, and add separate GLCanvas that uses shared contexts, and have the loading done in that frame's callbacks.

 

2. pBuffer Initialisation Timing Problems

Due to the implementation of JOGL, it is not possible to ensure that the pBuffer is initialised on the same frame as you create it. There is no known work around for this problem. The pBuffer will initialise itself at some random point of time in the future.

 

3. Why don't I get GLEventListener callbacks when I use a custom render thread?

A timing issue with the setup of JOGL (this is becoming a common theme, no?). JOGL requires that you first set the render thread, and then add the listeners. If you do this the other way around, then you won't get any callbacks. See Issue 54 for more information.