Areas


Topics

j3d.org

JOGL Basic Issues

  1. Why does my JOGL window not play nicely with Swing?
  2. net.java.games.jogl.GLException: Unable to lock surface
  3. Nothing is being drawn in a canvas in fullscreen mode
  4. When I use feature X my drawing suddenly drops to glacial speeds

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

 

1. Why does my JOGL window not play nicely with Swing?

This is a general problem that all heavyweight components have when mixed with Swing. The Java3D FAQ Swing Section tips also work with JOGL (and any other heavyweight renderer, such as JMF).

 

2. net.java.games.jogl.GLException: Unable to lock surface

JOGL appears to have some very weird internal setup timing that causes problems in odd ways. This exception comes when you have attempted to do something to the GLCanvas before adding it to another component that is not already visible. To avoid this, make sure you call setVisible(true) on the containing Frame/Window before adding the GLCanvas.

 

3. Nothing is being drawn in a canvas in fullscreen mode

A problem that seems to be inherent in mixing swing with heavyweight components on a Win32 system (Java3D suffers from the same problem, for example). This is due to some interactions with DirectDraw. To get the rendering happening again, set the following property on the command line to disable DirectDraw usage: -Dsun.java2d.noddraw=true

 

4. When I use feature X my drawing suddenly drops to glacial speeds

Typically this is a sign that the drivers have defaulted back to software rendering (particularly in the case of shaders). Alternatively, you may not be picking up the correct native drivers for your video card (on Win32, this seems to happen alarmingly often). Check that your drivers are up to date and that the features you want are supported in hardware. You may have to scale back your techniques to keep it in pure hardware.