DEBUG
protected static final boolean DEBUG
NO_FREE
protected static final boolean NO_FREE
VERBOSE
protected static final boolean VERBOSE
autoSwapBuffers
protected boolean autoSwapBuffers
component
protected Component component
deferredDestroy
protected boolean deferredDestroy
deferredReshapeAction
protected Runnable deferredReshapeAction
deferredSetRealized
protected boolean deferredSetRealized
haveResetGLUProcAddressTable
protected static boolean haveResetGLUProcAddressTable
noAutoRedraw
protected boolean noAutoRedraw
pendingOffscreenHeight
protected int pendingOffscreenHeight
pendingOffscreenResize
protected boolean pendingOffscreenResize
pendingOffscreenWidth
protected int pendingOffscreenWidth
perThreadContextStack
protected static final ThreadLocal perThreadContextStack
perThreadRenderingContext
protected static final ThreadLocal perThreadRenderingContext
perThreadSavedCurrentContext
protected static final ThreadLocal perThreadSavedCurrentContext
realized
protected boolean realized
renderingThread
protected Thread renderingThread
willSetRenderingThread
protected boolean willSetRenderingThread
bindPbufferToTexture
public abstract void bindPbufferToTexture()
Pbuffer support; given that this is a GLContext associated with a
pbuffer, binds this pbuffer to its texture target.
canCreatePbufferContext
public abstract boolean canCreatePbufferContext()
Pbuffer support; indicates whether this context is capable of
creating a subordinate pbuffer context (distinct from an
"offscreen context", which is typically software-rendered on all
platforms).
createGL
protected abstract GL createGL()
Create the GL for this context.
createPbufferContext
public abstract GLContext createPbufferContext(GLCapabilities capabilities,
int initialWidth,
int initialHeight)
Pbuffer support; creates a subordinate GLContext for a pbuffer
associated with this context.
destroy
public void destroy()
throws GLException
Destroys the underlying OpenGL context and changes the realized
state to false. This should be called when the widget is being
destroyed.
destroyImpl
protected abstract void destroyImpl()
throws GLException
Destroys the underlying OpenGL context.
dynamicLookupFunction
protected abstract long dynamicLookupFunction(String glFuncName)
Dynamically looks up the given function.
free
protected abstract void free()
throws GLException
Frees the OpenGL context. All error conditions cause a
GLException to be thrown.
getAutoSwapBufferMode
public boolean getAutoSwapBufferMode()
getFloatingPointMode
public int getFloatingPointMode()
throws GLException
Indicates which floating-point pbuffer implementation is in
use. Returns one of GLPbuffer.APPLE_FLOAT, GLPbuffer.ATI_FLOAT,
or GLPbuffer.NV_FLOAT.
getGLU
public GLU getGLU()
getNoAutoRedrawMode
public boolean getNoAutoRedrawMode()
getOffscreenContextHeight
public abstract int getOffscreenContextHeight()
Only called for offscreen contexts; needed by glReadPixels
getOffscreenContextPixelDataType
public abstract int getOffscreenContextPixelDataType()
Only called for offscreen contexts; needed by glReadPixels
getOffscreenContextReadBuffer
public abstract int getOffscreenContextReadBuffer()
Only called for offscreen contexts; returns the buffer from
which to read pixels (GL.GL_FRONT or GL.GL_BACK).
getOffscreenContextWidth
public abstract int getOffscreenContextWidth()
Only called for offscreen contexts; needed by glReadPixels
getPerThreadContextStack
protected static GLContextStack getPerThreadContextStack()
Support for recursive makeCurrent() calls as well as calling
other drawables' display() methods from within another one's
getPerThreadSavedCurrentContext
protected static GLContext getPerThreadSavedCurrentContext()
Support for setRenderingThread()'s optimized context handling
getPerThreadSavedInitAction
protected static Runnable getPerThreadSavedInitAction()
Support for setRenderingThread()'s optimized context handling
getPlatformExtensionsString
public abstract String getPlatformExtensionsString()
Returns a non-null (but possibly empty) string containing the
space-separated list of available platform-dependent (e.g., WGL,
GLX) extensions. Can only be called while this context is
current.
getRealized
public boolean getRealized()
Indicates whether the component associated with this context has
been realized.
getRenderingThread
public Thread getRenderingThread()
getThreadName
protected static String getThreadName()
invokeGL
public void invokeGL(Runnable runnable,
boolean isReshape,
Runnable initAction)
throws GLException
Runs the given runnable with this OpenGL context valid.
isCreated
public abstract boolean isCreated()
Indicates whether the underlying OpenGL context has been
created. This is used to manage sharing of display lists and
textures between contexts.
isExtensionAvailable
public boolean isExtensionAvailable(String glExtensionName)
Returns true if the specified OpenGL extension can be
successfully called using this GL context given the current host (OpenGL
client) and display (OpenGL
server) configuration.
See
GL.isExtensionAvailable(String)
for more details.
glExtensionName
- the name of the OpenGL extension (e.g.,
"GL_VERTEX_PROGRAM_ARB").
isFunctionAvailable
protected boolean isFunctionAvailable(String glFunctionName)
Returns true if the specified OpenGL core- or extension-function can be
successfully called using this GL context given the current host (OpenGL
client) and display (OpenGL
server) configuration.
See
GL.isFunctionAvailable(String)
for more details.
isOffscreen
protected abstract boolean isOffscreen()
Hook indicating whether the concrete GLContext implementation is
offscreen and therefore whether we need to process resize
requests.
isRealized
public boolean isRealized()
makeCurrent
protected abstract boolean makeCurrent(Runnable initAction)
throws GLException
Attempts to make the GL context current. If necessary, creates a
context and calls the initAction once the context is current.
Most error conditions cause an exception to be thrown, except
for the case where the context can not be created because the
component has not yet been visualized. In this case makeCurrent
returns false and the caller should abort any OpenGL event
processing and instead return immediately.
mapToRealGLExtensionName
protected abstract String mapToRealGLExtensionName(String glExtensionName)
Maps the given "platform-independent" extension name to a real
function name. Currently this is only used to map
"GL_ARB_pbuffer" and "GL_ARB_pixel_format" to "WGL_ARB_pbuffer"
and "WGL_ARB_pixel_format" (not yet mapped to X11).
mapToRealGLFunctionName
protected abstract String mapToRealGLFunctionName(String glFunctionName)
Maps the given "platform-independent" function name to a real function
name. Currently this is only used to map "glAllocateMemoryNV" and
associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV.
offscreenImageNeedsVerticalFlip
public abstract boolean offscreenImageNeedsVerticalFlip()
On some platforms the mismatch between OpenGL's coordinate
system (origin at bottom left) and the window system's
coordinate system (origin at top left) necessitates a vertical
flip of pixels read from offscreen contexts.
releasePbufferFromTexture
public abstract void releasePbufferFromTexture()
Pbuffer support; given that this is a GLContext associated with a
pbuffer, releases this pbuffer from its texture target.
resetGLFunctionAvailability
protected void resetGLFunctionAvailability()
Resets the cache of which GL functions are available for calling through this
context. See
isFunctionAvailable(String)
for more information on
the definition of "available".
resetProcAddressTable
protected void resetProcAddressTable(Object table)
Helper routine which resets a ProcAddressTable generated by the
GLEmitter by looking up anew all of its function pointers.
resizeOffscreenContext
public void resizeOffscreenContext(int newWidth,
int newHeight)
Routine needed only for offscreen contexts in order to resize
the underlying bitmap. Called by GLJPanel.
setAutoSwapBufferMode
public void setAutoSwapBufferMode(boolean autoSwapBuffers)
setGL
public void setGL(GL gl)
setGLU
public void setGLU(GLU glu)
setNoAutoRedrawMode
public void setNoAutoRedrawMode(boolean noAutoRedraw)
setPerThreadSavedCurrentContext
protected static void setPerThreadSavedCurrentContext(GLContext context,
Runnable initAction)
Support for setRenderingThread()'s optimized context handling
setRealized
public void setRealized()
Inform the system that the associated heavyweight widget has
been realized and that it is safe to create an associated OpenGL
context. If the widget is later destroyed then destroy() should
be called, which will cause the underlying OpenGL context to be
destroyed as well as the realized bit to be set to false.
setRealized
protected void setRealized(boolean realized)
Sets only the "realized" bit. Should be called by subclasses
from within the destroy() implementation.
setRenderingThread
public void setRenderingThread(Thread currentThreadOrNull,
Runnable initAction)
setSwapInterval
public void setSwapInterval(int interval)
swapBuffers
public abstract void swapBuffers()
throws GLException
Swaps the buffers of the OpenGL context if necessary. All error
conditions cause a GLException to be thrown.
willSetRenderingThread
public void willSetRenderingThread()
Gives a hint to the context that setRenderingThread will be
called in the near future; causes redraws to be halted. This is
a workaround for bugs in NVidia's drivers and is used only by
the Animator class.