com.sun.opengl.impl.x11
Class X11GLContext

java.lang.Object
  extended by javax.media.opengl.GLContext
      extended by com.sun.opengl.impl.GLContextImpl
          extended by com.sun.opengl.impl.x11.X11GLContext
Direct Known Subclasses:
X11ExternalGLContext, X11OffscreenGLContext, X11OnscreenGLContext, X11PbufferGLContext

public abstract class X11GLContext
extends GLContextImpl


Field Summary
protected  long context
           
protected  X11GLDrawable drawable
           
protected  long mostRecentDisplay
           
 
Fields inherited from class com.sun.opengl.impl.GLContextImpl
DEBUG, functionAvailability, gl, lock, NO_FREE, optimizationEnabled, VERBOSE
 
Fields inherited from class javax.media.opengl.GLContext
CONTEXT_CURRENT, CONTEXT_CURRENT_NEW, CONTEXT_NOT_CURRENT
 
Constructor Summary
X11GLContext(X11GLDrawable drawable, GLContext shareWith)
           
 
Method Summary
 void bindPbufferToTexture()
          Pbuffer support; given that this is a GLContext associated with a pbuffer, binds this pbuffer to its texture target.
 void copy(GLContext source, int mask)
          Copies selected groups of OpenGL state variables from the supplied source context into this one.
protected abstract  void create()
          Helper routine which usually just turns around and calls createContext (except for pbuffers, which use a different context creation mechanism).
protected  void createContext(boolean onscreen)
          Creates and initializes an appropriate OpenGL context.
protected  void destroyImpl()
           
 long getContext()
           
 GLDrawable getGLDrawable()
          Returns the GLDrawable to which this context may be used to draw.
 GLXExt getGLXExt()
           
 GLXExtProcAddressTable getGLXExtProcAddressTable()
           
 int getOffscreenContextPixelDataType()
          Only called for offscreen contexts; needed by glReadPixels
 int getOffscreenContextReadBuffer()
           
 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.
 java.lang.Object getPlatformGLExtensions()
           
 java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3)
           
 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()
           
protected  void lockToolkit()
           
protected  int makeCurrentImpl()
           
protected  java.lang.String mapToRealGLExtensionName(java.lang.String glExtensionName)
          Maps the given "platform-independent" extension name to a real function name.
protected  java.lang.String mapToRealGLFunctionName(java.lang.String glFunctionName)
          Maps the given "platform-independent" function name to a real function name.
 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.
protected  void releaseImpl()
           
 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.
 void setSwapInterval(int interval)
           
protected  void unlockToolkit()
           
 
Methods inherited from class com.sun.opengl.impl.GLContextImpl
createGL, destroy, getBufferSizeTracker, getDeletedObjectTracker, getFloatingPointMode, getGL, getGLProcAddressTable, getObjectTracker, getThreadName, hasWaiters, isSynchronized, makeCurrent, release, resetProcAddressTable, setBufferSizeTracker, setDeletedObjectTracker, setGL, setObjectTracker, setSynchronized, toHexString, update
 
Methods inherited from class javax.media.opengl.GLContext
getCurrent, setCurrent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

drawable

protected X11GLDrawable drawable

context

protected long context

mostRecentDisplay

protected long mostRecentDisplay
Constructor Detail

X11GLContext

public X11GLContext(X11GLDrawable drawable,
                    GLContext shareWith)
Method Detail

getPlatformGLExtensions

public java.lang.Object getPlatformGLExtensions()
Specified by:
getPlatformGLExtensions in class GLContextImpl

getGLXExt

public GLXExt getGLXExt()

getGLDrawable

public GLDrawable getGLDrawable()
Description copied from class: GLContext
Returns the GLDrawable to which this context may be used to draw.

Specified by:
getGLDrawable in class GLContext

mapToRealGLFunctionName

protected java.lang.String mapToRealGLFunctionName(java.lang.String glFunctionName)
Description copied from class: GLContextImpl
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.

Specified by:
mapToRealGLFunctionName in class GLContextImpl

mapToRealGLExtensionName

protected java.lang.String mapToRealGLExtensionName(java.lang.String glExtensionName)
Description copied from class: GLContextImpl
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).

Specified by:
mapToRealGLExtensionName in class GLContextImpl

create

protected abstract void create()
Helper routine which usually just turns around and calls createContext (except for pbuffers, which use a different context creation mechanism). Should only be called by makeCurrentImpl().


createContext

protected void createContext(boolean onscreen)
Creates and initializes an appropriate OpenGL context. Should only be called by create().


makeCurrentImpl

protected int makeCurrentImpl()
                       throws GLException
Specified by:
makeCurrentImpl in class GLContextImpl
Throws:
GLException

releaseImpl

protected void releaseImpl()
                    throws GLException
Specified by:
releaseImpl in class GLContextImpl
Throws:
GLException

destroyImpl

protected void destroyImpl()
                    throws GLException
Specified by:
destroyImpl in class GLContextImpl
Throws:
GLException

isCreated

public boolean isCreated()
Description copied from class: GLContextImpl
Indicates whether the underlying OpenGL context has been created. This is used to manage sharing of display lists and textures between contexts.

Specified by:
isCreated in class GLContextImpl

copy

public void copy(GLContext source,
                 int mask)
          throws GLException
Description copied from class: GLContext
Copies selected groups of OpenGL state variables from the supplied source context into this one. The mask parameter indicates which groups of state variables are to be copied. mask contains the bitwise OR of the same symbolic names that are passed to the GL command glPushAttrib. The single symbolic constant GL_ALL_ATTRIB_BITS can be used to copy the maximum possible portion of rendering state.

Not all values for GL state can be copied. For example, pixel pack and unpack state, render mode state, and select and feedback state are not copied. The state that can be copied is exactly the state that is manipulated by the GL command glPushAttrib.

On most platforms, this context may not be current to any thread, including the calling thread, when this method is called. Some platforms have additional requirements such as whether this context or the source context must occasionally be made current in order for the results of the copy to be seen; these requirements are beyond the scope of this specification.

Specified by:
copy in class GLContext
Parameters:
source - the source OpenGL context from which to copy state
mask - a mask of symbolic names indicating which groups of state to copy
Throws:
GLException - if an OpenGL-related error occurred

resetGLFunctionAvailability

protected void resetGLFunctionAvailability()
Description copied from class: GLContextImpl
Resets the cache of which GL functions are available for calling through this context. See GLContextImpl.isFunctionAvailable(String) for more information on the definition of "available".

Overrides:
resetGLFunctionAvailability in class GLContextImpl

getGLXExtProcAddressTable

public GLXExtProcAddressTable getGLXExtProcAddressTable()

getPlatformExtensionsString

public java.lang.String getPlatformExtensionsString()
Description copied from class: GLContextImpl
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.

Specified by:
getPlatformExtensionsString in class GLContextImpl

isFunctionAvailable

protected boolean isFunctionAvailable(java.lang.String glFunctionName)
Description copied from class: GLContextImpl
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.

Overrides:
isFunctionAvailable in class GLContextImpl
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)
Description copied from class: GLContextImpl
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.

Overrides:
isExtensionAvailable in class GLContextImpl
Parameters:
glExtensionName - the name of the OpenGL extension (e.g., "GL_VERTEX_PROGRAM_ARB").

setSwapInterval

public void setSwapInterval(int interval)
Overrides:
setSwapInterval in class GLContextImpl

glAllocateMemoryNV

public java.nio.ByteBuffer glAllocateMemoryNV(int arg0,
                                              float arg1,
                                              float arg2,
                                              float arg3)
Specified by:
glAllocateMemoryNV in class GLContextImpl

getOffscreenContextPixelDataType

public int getOffscreenContextPixelDataType()
Description copied from class: GLContextImpl
Only called for offscreen contexts; needed by glReadPixels

Specified by:
getOffscreenContextPixelDataType in class GLContextImpl

getOffscreenContextReadBuffer

public int getOffscreenContextReadBuffer()

offscreenImageNeedsVerticalFlip

public boolean offscreenImageNeedsVerticalFlip()
Description copied from class: GLContextImpl
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.

Specified by:
offscreenImageNeedsVerticalFlip in class GLContextImpl

bindPbufferToTexture

public void bindPbufferToTexture()
Description copied from class: GLContextImpl
Pbuffer support; given that this is a GLContext associated with a pbuffer, binds this pbuffer to its texture target.

Specified by:
bindPbufferToTexture in class GLContextImpl

releasePbufferFromTexture

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

Specified by:
releasePbufferFromTexture in class GLContextImpl

isOptimizable

public boolean isOptimizable()
Overrides:
isOptimizable in class GLContextImpl

getContext

public long getContext()

lockToolkit

protected void lockToolkit()

unlockToolkit

protected void unlockToolkit()


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