|
|||||||||
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 com.jogamp.opengl.impl.ExtensionAvailabilityCache |
extensionAvailability
|
protected GL |
gl
|
protected boolean |
hasNativeES2Methods
|
protected GLContextLock |
lock
|
protected static Object |
mappedContextTypeObjectLock
|
protected static HashMap |
mappedExtensionAvailabilityCache
|
protected static HashMap |
mappedGLProcAddress
|
protected static HashMap |
mappedGLXProcAddress
|
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, DEBUG0, deviceVersionAvailable, GL_VERSIONS |
Constructor Summary | |
---|---|
GLContextImpl(GLDrawableImpl drawable,
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.The implementation shall leave the context current. |
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()
|
protected String |
getContextFQN()
|
protected static String |
getContextFQN(AbstractGraphicsDevice device,
int major,
int minor,
int ctp)
|
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. |
String |
getGLExtensionsString()
Returns a non-null (but possibly empty) string containing the space-separated list of available extensions. |
ProcAddressTable |
getGLProcAddressTable()
|
GLDrawable |
getGLReadDrawable()
Returns the read GLDrawable this context uses for read framebuffer operations. |
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 ProcAddressTable |
getPlatformExtProcAddressTable()
Shall return the platform extension ProcAddressTable, ie for GLXExt, EGLExt, .. |
abstract Object |
getPlatformGLExtensions()
|
int |
getSwapInterval()
|
abstract ByteBuffer |
glAllocateMemoryNV(int arg0,
float arg1,
float arg2,
float arg3)
|
boolean |
hasNativeES2Methods()
|
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[])
#mapVersionAvailable
|
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(ProcAddressTable table)
Helper routine which resets a ProcAddressTable generated by the GLEmitter by looking up anew all of its function pointers. |
protected void |
resetStates()
|
void |
setBufferSizeTracker(GLBufferSizeTracker bufferSizeTracker)
|
GL |
setGL(GL gl)
Sets the GL pipeline object for this GLContext. |
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 |
setGLReadDrawable(GLDrawable read)
Set the read GLDrawable for read framebuffer operations. The caller should query if this feature is supported via GLContext.isGLReadDrawableAvailable() . |
void |
setSwapInterval(int interval)
|
protected void |
setSwapIntervalImpl(int interval)
|
void |
setSynchronized(boolean isSynchronized)
Determines whether 'makeCurrent' will exhibit synchronized behavior. |
protected void |
update()
|
protected abstract void |
updateGLXProcAddressTable()
Updates the platform's 'GLX' function cache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final boolean DEBUG
protected GLContextLock lock
protected com.jogamp.opengl.impl.ExtensionAvailabilityCache extensionAvailability
protected GLDrawableImpl drawable
protected GLDrawableImpl drawableRead
protected GL gl
protected static final Object mappedContextTypeObjectLock
protected static final HashMap mappedExtensionAvailabilityCache
protected static final HashMap mappedGLProcAddress
protected static final HashMap mappedGLXProcAddress
protected int currentSwapInterval
protected boolean hasNativeES2Methods
Constructor Detail |
---|
public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith)
Method Detail |
---|
protected void resetStates()
resetStates
in class GLContext
public final void setGLReadDrawable(GLDrawable read)
GLContext
GLContext.isGLReadDrawableAvailable()
.
setGLReadDrawable
in class GLContext
read
- the read GLDrawable for read framebuffer operations.
If null is passed, the default write drawable will be set.GLContext.isGLReadDrawableAvailable()
,
GLContext.getGLReadDrawable()
public final GLDrawable getGLReadDrawable()
GLContext
getGLReadDrawable
in class GLContext
GLContext.isGLReadDrawableAvailable()
,
GLContext.setGLReadDrawable(javax.media.opengl.GLDrawable)
public final GLDrawable getGLDrawable()
GLContext
getGLDrawable
in class GLContext
public final 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()
GLContextImplmakeCurrentImpl(boolean)
Platform Implementation#create
Platform ImplementationARB_create_context
is supported:
createContextARB(long, boolean, int[], int[], int[])
GLContextImplcreateContextARBImpl(long, boolean, int, int, int)
Platform ImplementationGLDrawableFactoryImpl
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)
,
#mapVersionAvailable
,
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 GL createGL(GLProfile glp)
public final ProcAddressTable getGLProcAddressTable()
public abstract 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(ProcAddressTable table)
protected final 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 useful if you change the OpenGL implementation.setContextVersion(int, int, int)
protected abstract void updateGLXProcAddressTable()
public final boolean hasNativeES2Methods()
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 getGLExtensionsString()
GLContext
glGetString
(GL_EXTENSIONS
)
getGLExtensionsString
in class GLContext
public final boolean isExtensionCacheInitialized()
protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctp)
protected String getContextFQN()
public int getFloatingPointMode() throws GLException
GLException
public abstract boolean offscreenImageNeedsVerticalFlip()
public abstract int getOffscreenContextPixelDataType()
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 |