I prefer using
GLDrawableFactory.createOffscreenAutoDrawable(..) for a resizable GLAutoDrawable and GLEventListener.
Otherwise, if I only need a manually hacked GLDrawable, use GLDrawableFactory.createOffscreenDrawable(..).
Both can be used for a shared GLContext.
For this, a shared GLContext, you may also use a dummy drawable
from GLDrawableFactory.createDummyDrawable().
Since I currently fix an EGL issue in this area and commenting here,
I see that we also could use the surfaceless drawable for GLDrawableFactory.createDummyDrawable()
if available - I will check on this, as it would reduce resources a bit further.Unit tests for GLAutoDrawable showing its usage are available e.g. in
TestGLAutoDrawableFactoryES2OffscrnCapsNEWTand GLMedialayerImpl uses GLDrawableFactory.createDummyDrawable().
I do prefer this low-level API, since a NEWT offscreen GLWindow adds more dependencies and resources
not required if you only want to have a non-windowing system offscreen (usually FBO).
GLDrawableFactory's createOffscreen[Auto]Drawable(..) uses the best implementation
if available, i.e. for FBO either createSurfacelessImpl(..) or createDummySurfaceImpl(..),
otherwise a generic createMutableSurfaceImpl(..) w/o FBO relation.
In the unit test class
UITestCase, you will find a SnapshotGLEventListener,
which utilizes
GLReadBufferUtil to take a snapshot from the current front framebuffer.
This essentially simply reads the pixels and writes a file using either format: png, netpbm, tga, ...
+++
The API doc system we still use, i.e. javadoc, is of poor quality,
as it does not properly link to the unit test examples automatically.
When I change this to Doxygen this shall be resolved.
Manual fix: Show call graph in the imported whole project in your favorite IDE.
Perhaps this also works well when loading the jar w/ sources.