Class GLCanvas

java.lang.Object
java.awt.Component
java.awt.Canvas
com.jogamp.opengl.awt.GLCanvas
All Implemented Interfaces:
AWTPrintLifecycle, NativeSurfaceHolder, OffscreenLayerOption, ScalableSurface, WindowClosingProtocol, AWTGLAutoDrawable, ComponentEvents, GLAutoDrawable, GLDrawable, GLSharedContextSetter, ImageObserver, MenuContainer, Serializable, Accessible

A heavyweight AWT component which provides OpenGL rendering support. This is the primary implementation of an AWT GLDrawable; GLJPanel is provided for compatibility with Swing user interfaces when adding a heavyweight doesn't work either because of Z-ordering or LayoutManager problems.
Offscreen Layer Remarks
setShallUseOffscreenLayer(true) maybe called to use an offscreen drawable (FBO or PBuffer) allowing the underlying JAWT mechanism to composite the image, if supported.

setShallUseOffscreenLayer(true) is being called if CapabilitiesImmutable.isOnscreen() is false.

Java2D OpenGL Remarks
To avoid any conflicts with a potential Java2D OpenGL context,
you shall consider setting the following JVM properties:
  • sun.java2d.opengl=false
  • sun.java2d.noddraw=true
This is especially true in case you want to utilize a GLProfile other than GLProfile.GL2, eg. using GLProfile#getMaxFixedFunc().
On the other hand, if you like to experiment with GLJPanel's utilization of Java2D's OpenGL pipeline, you have to set them to
  • sun.java2d.opengl=true
  • sun.java2d.noddraw=true
Disable Background Erase
GLCanvas tries to disable background erase for the AWT Canvas before native peer creation (X11) and after it (Windows),
utilizing the optional Toolkit method disableBeackgroundErase(java.awt.Canvas).
However if this does not give you the desired results, you may want to disable AWT background erase in general:
  • sun.awt.noerasebackground=true

OpenGL Context Sharing
To share a GLContext see the following note in the documentation overview: context sharing as well as GLSharedContextSetter.

See Also: