|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.media.opengl.GLContext
com.jogamp.opengl.impl.GLContextImpl
public abstract class GLContextImpl
Field Summary | |
---|---|
protected int |
currentSwapInterval
|
protected static boolean |
DEBUG
|
protected GLDrawableImpl |
drawable
|
protected GLDrawableImpl |
drawableRead
|
protected ExtensionAvailabilityCache |
extensionAvailability
|
protected GL |
gl
|
protected GLContextLock |
lock
|
protected static boolean |
VERBOSE
|
Fields inherited from class javax.media.opengl.GLContext |
---|
CONTEXT_CURRENT, CONTEXT_CURRENT_NEW, CONTEXT_NOT_CURRENT, contextHandle, CTX_IS_ARB_CREATED, CTX_OPTION_ANY, CTX_OPTION_DEBUG, CTX_OPTION_FORWARD, CTX_PROFILE_COMPAT, CTX_PROFILE_CORE, CTX_PROFILE_ES, ctxMajorVersion, ctxMinorVersion, ctxOptions, ctxVersionString, GL_VERSIONS, mappedVersionsAvailable, mappedVersionsAvailableLock, mappedVersionsAvailableSet |
Constructor Summary | |
---|---|
GLContextImpl(GLDrawableImpl drawable,
GLContext shareWith)
|
|
GLContextImpl(GLDrawableImpl drawable,
GLDrawableImpl drawableRead,
GLContext shareWith)
|
Method Summary | |
---|---|
abstract 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 |
copyImpl(GLContext source,
int mask)
|
protected long |
createContextARB(long share,
boolean direct,
int[] major,
int[] minor,
int[] ctp)
Platform independent part of using the ARB_create_context
mechanism to create a context.The implementation of #create shall use this protocol in case the platform supports ARB_create_context .This method may call createContextARBImpl(long, boolean, int, int, int) and destroyContextARBImpl(long) . |
protected abstract long |
createContextARBImpl(long share,
boolean direct,
int ctxOptionFlags,
int major,
int minor)
Platform dependent but harmonized implementation of the ARB_create_context
mechanism to create a context.This method is called from createContextARB(long, boolean, int[], int[], int[]) .The implementation shall verify this context with a MakeContextCurrent call. |
protected GL |
createGL(GLProfile glp)
Create the GL for this context. |
protected abstract boolean |
createImpl()
|
void |
destroy()
Destroys this OpenGL context and frees its associated resources. |
protected abstract void |
destroyContextARBImpl(long context)
Destroy the context created by createContextARBImpl(long, boolean, int, int, int) . |
protected abstract void |
destroyImpl()
|
GLBufferSizeTracker |
getBufferSizeTracker()
|
GLBufferStateTracker |
getBufferStateTracker()
|
GLDrawableImpl |
getDrawableImpl()
|
protected abstract Map |
getExtensionNameMap()
|
int |
getFloatingPointMode()
Indicates which floating-point pbuffer implementation is in use. |
protected abstract Map |
getFunctionNameMap()
|
GL |
getGL()
Returns the GL pipeline object for this GLContext. |
GLDrawable |
getGLDrawable()
Returns the GLDrawable to which this context may be used to draw. |
GLDrawable |
getGLDrawableRead()
Returns the GLDrawable from which this context may be used to read. |
String |
getGLExtensions()
|
com.jogamp.gluegen.runtime.ProcAddressTable |
getGLProcAddressTable()
|
GLStateTracker |
getGLStateTracker()
|
abstract int |
getOffscreenContextPixelDataType()
Only called for offscreen contexts; needed by glReadPixels |
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 com.jogamp.gluegen.runtime.ProcAddressTable |
getPlatformExtProcAddressTable()
Shall return the platform extension ProcAddressTable, ie for GLXExt, EGLExt, .. |
abstract Object |
getPlatformGLExtensions()
|
int |
getSwapInterval()
|
protected static String |
getThreadName()
|
abstract ByteBuffer |
glAllocateMemoryNV(int arg0,
float arg1,
float arg2,
float arg3)
|
boolean |
hasWaiters()
|
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. |
boolean |
isExtensionCacheInitialized()
|
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. |
boolean |
isSynchronized()
Returns true if 'makeCurrent' will exhibit synchronized behavior. |
int |
makeCurrent()
MakeCurrent functionality, which also issues the creation of the actual OpenGL context. The complete callgraph for general OpenGL context creation is: makeCurrent() GLContextImpl
makeCurrentImpl(boolean) Platform Implementation
#create Platform Implementation
If ARB_create_context is supported:
createContextARB(long, boolean, int[], int[], int[]) GLContextImpl
createContextARBImpl(long, boolean, int, int, int) Platform Implementation
Once at startup, ie triggered by the singleton constructor of a GLDrawableFactoryImpl specialization,
calling createContextARB(long, boolean, int[], int[], int[]) will query all available OpenGL versions:FOR ALL GL* DO :
createContextARBMapVersionsAvailable(int, boolean)
createContextARBVersions(long, boolean, int, int, int, int, int, int[], int[])
GLContext.mapVersionAvailable(int, int, int, int, int)
|
protected abstract void |
makeCurrentImpl(boolean newCreatedContext)
|
protected int |
makeCurrentLocking()
|
protected String |
mapToRealGLExtensionName(String glExtensionName)
Maps the given "platform-independent" extension name to a real function name. |
protected String |
mapToRealGLFunctionName(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 |
resetProcAddressTable(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)
|
protected void |
setContextVersion(int major,
int minor,
int ctp)
If major > 0 || minor > 0 : Use passed values, determined at creation time If major==0 && minor == 0 : Use GL_VERSION Otherwise .. |
GL |
setGL(GL gl)
Sets the GL pipeline object for this GLContext. |
void |
setGLDrawableRead(GLDrawable read)
Set the GLDrawable from which this context may be used to read. If read is null, the default write drawable will be used. |
protected void |
setGLFunctionAvailability(boolean force,
int major,
int minor,
int ctp)
Sets the OpenGL implementation class and the cache of which GL functions are available for calling through this context. |
void |
setSwapInterval(int interval)
|
protected void |
setSwapIntervalImpl(int interval)
|
void |
setSynchronized(boolean isSynchronized)
Determines whether 'makeCurrent' will exhibit synchronized behavior. |
protected void |
update()
|
protected void |
updateGLProcAddressTable(int major,
int minor,
int ctp)
Updates the cache of which GL functions are available for calling through this context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected GLContextLock lock
protected static final boolean DEBUG
protected static final boolean VERBOSE
protected ExtensionAvailabilityCache extensionAvailability
protected GLDrawableImpl drawable
protected GLDrawableImpl drawableRead
protected GL gl
protected int currentSwapInterval
Constructor Detail |
---|
public GLContextImpl(GLDrawableImpl drawable, GLDrawableImpl drawableRead, GLContext shareWith)
public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith)
Method Detail |
---|
public void setGLDrawableRead(GLDrawable read)
GLContext
setGLDrawableRead
in class GLContext
public GLDrawable getGLDrawable()
GLContext
getGLDrawable
in class GLContext
public GLDrawable getGLDrawableRead()
GLContext
getGLDrawableRead
in class GLContext
public GLDrawableImpl getDrawableImpl()
public final GL getGL()
GLContext
getGL
in class GLContext
public GL setGL(GL gl)
GLContext
setGL
in class GLContext
protected void update() throws GLException
GLException
public boolean isSynchronized()
GLContext
isSynchronized
in class GLContext
public void setSynchronized(boolean isSynchronized)
GLContext
setSynchronized
in class GLContext
public abstract Object getPlatformGLExtensions()
public void release() throws GLException
GLContext
release
in class GLContext
GLException
- if the context had not previously been made
current on the current threadprotected abstract void releaseImpl() throws GLException
GLException
public final void destroy()
GLContext
destroy
in class GLContext
protected abstract void destroyImpl() throws GLException
GLException
public final void copy(GLContext source, int mask) throws GLException
GLContext
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.
copy
in class GLContext
source
- the source OpenGL context from which to copy statemask
- a mask of symbolic names indicating which groups of state to copy
GLException
- if an OpenGL-related error occurredprotected abstract void copyImpl(GLContext source, int mask) throws GLException
GLException
public int makeCurrent() throws GLException
makeCurrent()
GLContextImpl
makeCurrentImpl(boolean)
Platform Implementation
#create
Platform Implementation
ARB_create_context
is supported:
createContextARB(long, boolean, int[], int[], int[])
GLContextImpl
createContextARBImpl(long, boolean, int, int, int)
Platform Implementation
GLDrawableFactoryImpl
specialization,
calling createContextARB(long, boolean, int[], int[], int[])
will query all available OpenGL versions:FOR ALL GL* DO
:
makeCurrent
in class GLContext
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(boolean)
,
#create
,
createContextARB(long, boolean, int[], int[], int[])
,
createContextARBImpl(long, boolean, int, int, int)
,
GLContext.mapVersionAvailable(int, int, int, int, int)
,
destroyContextARBImpl(long)
protected final int makeCurrentLocking() throws GLException
GLException
protected abstract void makeCurrentImpl(boolean newCreatedContext) throws GLException
GLException
protected abstract boolean createImpl() throws GLException
GLException
protected abstract long createContextARBImpl(long share, boolean direct, int ctxOptionFlags, int major, int minor)
ARB_create_context
mechanism to create a context.createContextARB(long, boolean, int[], int[], int[])
.MakeContextCurrent
call.
share
- the shared context or nulldirect
- flag if direct is requestedctxOptionFlags
- ARB_create_context
related, see references belowmajor
- major numberminor
- minor number
makeCurrent()
,
GLContext.CTX_PROFILE_COMPAT
,
GLContext.CTX_OPTION_FORWARD
,
GLContext.CTX_OPTION_DEBUG
,
makeCurrentImpl(boolean)
,
#create
,
createContextARB(long, boolean, int[], int[], int[])
,
createContextARBImpl(long, boolean, int, int, int)
,
destroyContextARBImpl(long)
protected abstract void destroyContextARBImpl(long context)
createContextARBImpl(long, boolean, int, int, int)
.
makeCurrent()
,
makeCurrentImpl(boolean)
,
#create
,
createContextARB(long, boolean, int[], int[], int[])
,
createContextARBImpl(long, boolean, int, int, int)
,
destroyContextARBImpl(long)
protected final long createContextARB(long share, boolean direct, int[] major, int[] minor, int[] ctp)
ARB_create_context
mechanism to create a context.#create
shall use this protocol in case the platform supports ARB_create_context
.createContextARBImpl(long, boolean, int, int, int)
and destroyContextARBImpl(long)
.
makeCurrentImpl(boolean)
,
#create
,
createContextARB(long, boolean, int[], int[], int[])
,
createContextARBImpl(long, boolean, int, int, int)
,
destroyContextARBImpl(long)
protected final void setContextVersion(int major, int minor, int ctp)
protected GL createGL(GLProfile glp)
public final com.jogamp.gluegen.runtime.ProcAddressTable getGLProcAddressTable()
public abstract com.jogamp.gluegen.runtime.ProcAddressTable getPlatformExtProcAddressTable()
public abstract void bindPbufferToTexture()
public abstract void releasePbufferFromTexture()
public abstract ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3)
public final void setSwapInterval(int interval)
protected void setSwapIntervalImpl(int interval)
public int getSwapInterval()
protected String mapToRealGLFunctionName(String glFunctionName)
protected abstract Map getFunctionNameMap()
protected String mapToRealGLExtensionName(String glExtensionName)
protected abstract Map getExtensionNameMap()
protected void resetProcAddressTable(Object table)
protected void setGLFunctionAvailability(boolean force, int major, int minor, int ctp)
isFunctionAvailable(String)
for more information on
the definition of "available".
force
- force the setting, even if is already being set.
This might be usefull if you change the OpenGL implementation.setContextVersion(int, int, int)
protected void updateGLProcAddressTable(int major, int minor, int ctp)
isFunctionAvailable(String)
for more information on
the definition of "available".
setContextVersion(int, int, int)
public boolean isFunctionAvailable(String glFunctionName)
GLBase.isFunctionAvailable(String)
for more details.
glFunctionName
- the name of the OpenGL function (e.g., use
"glPolygonOffsetEXT" or "glPolygonOffset" to check if the GL.glPolygonOffset(float,float)
is available).public boolean isExtensionAvailable(String glExtensionName)
GLBase.isExtensionAvailable(String)
for more details.
glExtensionName
- the name of the OpenGL extension (e.g.,
"GL_VERTEX_PROGRAM_ARB").public String getPlatformExtensionsString()
GLContext
getPlatformExtensionsString
in class GLContext
public String getGLExtensions()
public boolean isExtensionCacheInitialized()
public int getFloatingPointMode() throws GLException
GLException
public abstract boolean offscreenImageNeedsVerticalFlip()
public abstract int getOffscreenContextPixelDataType()
protected static String getThreadName()
public void setBufferSizeTracker(GLBufferSizeTracker bufferSizeTracker)
public GLBufferSizeTracker getBufferSizeTracker()
public GLBufferStateTracker getBufferStateTracker()
public GLStateTracker getGLStateTracker()
public boolean hasWaiters()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |