com.sun.opengl.impl
Class GLContextImpl

java.lang.Object
  extended by javax.media.opengl.GLContext
      extended by com.sun.opengl.impl.GLContextImpl
Direct Known Subclasses:
X11GLContext

public abstract class GLContextImpl
extends GLContext


Field Summary
protected static boolean DEBUG
           
protected  FunctionAvailabilityCache functionAvailability
           
protected  GL gl
           
protected  GLContextLock lock
           
protected static boolean NO_FREE
           
protected  boolean optimizationEnabled
           
protected static boolean VERBOSE
           
 
Fields inherited from class javax.media.opengl.GLContext
CONTEXT_CURRENT, CONTEXT_CURRENT_NEW, CONTEXT_NOT_CURRENT
 
Constructor Summary
GLContextImpl(GLContext shareWith)
           
GLContextImpl(GLContext shareWith, boolean dontShareWithJava2D)
           
 
Method Summary
abstract  void bindPbufferToTexture()
          Pbuffer support; given that this is a GLContext associated with a pbuffer, binds this pbuffer to its texture target.
protected  GL createGL()
          Create the GL for this context.
 void destroy()
          Destroys this OpenGL context and frees its associated resources.
protected abstract  void destroyImpl()
           
 GLBufferSizeTracker getBufferSizeTracker()
           
 GLObjectTracker getDeletedObjectTracker()
           
 int getFloatingPointMode()
          Indicates which floating-point pbuffer implementation is in use.
 GL getGL()
          Returns the GL pipeline object for this GLContext.
 GLProcAddressTable getGLProcAddressTable()
           
 GLObjectTracker getObjectTracker()
           
abstract  int getOffscreenContextPixelDataType()
          Only called for offscreen contexts; needed by glReadPixels
abstract  java.lang.String getPlatformExtensionsString()
          Returns a non-null (but possibly empty) string containing the space-separated list of available platform-dependent (e.g., WGL, GLX) extensions.
abstract  java.lang.Object getPlatformGLExtensions()
           
protected static java.lang.String getThreadName()
           
abstract  java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3)
           
 boolean hasWaiters()
           
abstract  boolean isCreated()
          Indicates whether the underlying OpenGL context has been created.
 boolean isExtensionAvailable(java.lang.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.
protected  boolean isFunctionAvailable(java.lang.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.
 boolean isOptimizable()
           
 boolean isSynchronized()
          Returns true if 'makeCurrent' will exhibit synchronized behavior.
 int makeCurrent()
          Makes this GLContext current on the calling thread.
protected abstract  int makeCurrentImpl()
           
protected abstract  java.lang.String mapToRealGLExtensionName(java.lang.String glExtensionName)
          Maps the given "platform-independent" extension name to a real function name.
protected abstract  java.lang.String mapToRealGLFunctionName(java.lang.String glFunctionName)
          Maps the given "platform-independent" function name to a real function name.
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.
 void release()
          Releases control of this GLContext from the current thread.
protected abstract  void releaseImpl()
           
abstract  void releasePbufferFromTexture()
          Pbuffer support; given that this is a GLContext associated with a pbuffer, releases this pbuffer from its texture target.
protected  void resetGLFunctionAvailability()
          Resets the cache of which GL functions are available for calling through this context.
protected  void resetProcAddressTable(java.lang.Object table)
          Helper routine which resets a ProcAddressTable generated by the GLEmitter by looking up anew all of its function pointers.
 void setBufferSizeTracker(GLBufferSizeTracker bufferSizeTracker)
           
 void setDeletedObjectTracker(GLObjectTracker deletedObjectTracker)
           
 void setGL(GL gl)
          Sets the GL pipeline object for this GLContext.
 void setObjectTracker(GLObjectTracker tracker)
           
 void setSwapInterval(int interval)
           
 void setSynchronized(boolean isSynchronized)
          Determines whether 'makeCurrent' will exhibit synchronized behavior.
static java.lang.String toHexString(long hex)
           
protected  void update()
           
 
Methods inherited from class javax.media.opengl.GLContext
copy, getCurrent, getGLDrawable, setCurrent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

protected GLContextLock lock

DEBUG

protected static final boolean DEBUG

VERBOSE

protected static final boolean VERBOSE

NO_FREE

protected static final boolean NO_FREE

optimizationEnabled

protected boolean optimizationEnabled

functionAvailability

protected FunctionAvailabilityCache functionAvailability

gl

protected GL gl
Constructor Detail

GLContextImpl

public GLContextImpl(GLContext shareWith)

GLContextImpl

public GLContextImpl(GLContext shareWith,
                     boolean dontShareWithJava2D)
Method Detail

makeCurrent

public int makeCurrent()
                throws GLException
Description copied from class: GLContext
Makes this GLContext current on the calling thread. There are two return values that indicate success and one that indicates failure. A return value of CONTEXT_CURRENT_NEW indicates that that context has been made current, and that this is the first time this context has been made current, or that the state of the underlying context or drawable may have changed since the last time this context was made current. In this case, the application may wish to initialize the state. A return value of CONTEXT_CURRENT indicates that the context has been made currrent, with its previous state restored. If the context could not be made current (for example, because the underlying drawable has not ben realized on the display) , a value of CONTEXT_NOT_CURRENT is returned. If the context is in use by another thread at the time of the call, then if isSynchronized() is true the call will block. If isSynchronized() is false, an exception will be thrown and the context will remain current on the other thread.

Specified by:
makeCurrent in class GLContext
Returns:
CONTEXT_CURRENT if the context was successfully made current
Throws:
GLException - if synchronization is disabled and the context is current on another thread, or because the context could not be created or made current due to non-recoverable, window system-specific errors.

makeCurrentImpl

protected abstract int makeCurrentImpl()
                                throws GLException
Throws:
GLException

release

public void release()
             throws GLException
Description copied from class: GLContext
Releases control of this GLContext from the current thread.

Specified by:
release in class GLContext
Throws:
GLException - if the context had not previously been made current on the current thread

releaseImpl

protected abstract void releaseImpl()
                             throws GLException
Throws:
GLException

destroy

public void destroy()
Description copied from class: GLContext
Destroys this OpenGL context and frees its associated resources. The context should have been released before this method is called.

Specified by:
destroy in class GLContext

destroyImpl

protected abstract void destroyImpl()
                             throws GLException
Throws:
GLException

update

protected void update()
               throws GLException
Throws:
GLException

isSynchronized

public boolean isSynchronized()
Description copied from class: GLContext
Returns true if 'makeCurrent' will exhibit synchronized behavior.

Specified by:
isSynchronized in class GLContext

setSynchronized

public void setSynchronized(boolean isSynchronized)
Description copied from class: GLContext
Determines whether 'makeCurrent' will exhibit synchronized behavior.

Specified by:
setSynchronized in class GLContext

getGL

public GL getGL()
Description copied from class: GLContext
Returns the GL pipeline object for this GLContext.

Specified by:
getGL in class GLContext

setGL

public void setGL(GL gl)
Description copied from class: GLContext
Sets the GL pipeline object for this GLContext.

Specified by:
setGL in class GLContext

getPlatformGLExtensions

public abstract java.lang.Object getPlatformGLExtensions()

createGL

protected GL createGL()
Create the GL for this context.


getGLProcAddressTable

public GLProcAddressTable getGLProcAddressTable()

bindPbufferToTexture

public abstract void bindPbufferToTexture()
Pbuffer support; given that this is a GLContext associated with a pbuffer, binds this pbuffer to its texture target.


releasePbufferFromTexture

public abstract void releasePbufferFromTexture()
Pbuffer support; given that this is a GLContext associated with a pbuffer, releases this pbuffer from its texture target.


glAllocateMemoryNV

public abstract java.nio.ByteBuffer glAllocateMemoryNV(int arg0,
                                                       float arg1,
                                                       float arg2,
                                                       float arg3)

setSwapInterval

public void setSwapInterval(int interval)

mapToRealGLFunctionName

protected abstract java.lang.String mapToRealGLFunctionName(java.lang.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.


mapToRealGLExtensionName

protected abstract java.lang.String mapToRealGLExtensionName(java.lang.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).


getPlatformExtensionsString

public abstract java.lang.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.


resetProcAddressTable

protected void resetProcAddressTable(java.lang.Object table)
Helper routine which resets a ProcAddressTable generated by the GLEmitter by looking up anew all of its function pointers.


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.


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".


isFunctionAvailable

protected boolean isFunctionAvailable(java.lang.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.

Parameters:
glFunctionName - the name of the OpenGL function (e.g., use "glPolygonOffsetEXT" to check if the javax.media.opengl.GL#glPolygonOffsetEXT(float,float) is available).

isExtensionAvailable

public boolean isExtensionAvailable(java.lang.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.

Parameters:
glExtensionName - the name of the OpenGL extension (e.g., "GL_VERTEX_PROGRAM_ARB").

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.

Throws:
GLException

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.


getOffscreenContextPixelDataType

public abstract int getOffscreenContextPixelDataType()
Only called for offscreen contexts; needed by glReadPixels


getThreadName

protected static java.lang.String getThreadName()

toHexString

public static java.lang.String toHexString(long hex)

setBufferSizeTracker

public void setBufferSizeTracker(GLBufferSizeTracker bufferSizeTracker)

getBufferSizeTracker

public GLBufferSizeTracker getBufferSizeTracker()

setObjectTracker

public void setObjectTracker(GLObjectTracker tracker)

getObjectTracker

public GLObjectTracker getObjectTracker()

setDeletedObjectTracker

public void setDeletedObjectTracker(GLObjectTracker deletedObjectTracker)

getDeletedObjectTracker

public GLObjectTracker getDeletedObjectTracker()

isOptimizable

public boolean isOptimizable()

hasWaiters

public boolean hasWaiters()


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.