diff options
author | Sven Gothel <[email protected]> | 2013-04-10 03:22:19 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-04-10 03:22:19 +0200 |
commit | 7978096bdaac4c4bd14187382bb1f8ab9d082ebe (patch) | |
tree | a30b3d0384b743b2ff0ad71773ded614dd20bd4f /src/jogl/classes/jogamp/opengl/GLContextImpl.java | |
parent | eff09c3545f32f1f481198d57de71a5bf564e797 (diff) |
GLDrawable: Refine API doc; GLDrawableImpl: Balance createHandle()/destroyHandle(); Handle LOCK_SURFACE_CHANGED in lockSurface() ; GLContextImpl.makeCurrent(): Fix drawable handle validation.
GLDrawable: Refine API doc (realized/handle)
- Lifecycle of the drawable handle was not clear
- Ephasizing handle's dependency on NativeSurface's lock state and drawable's realization
GLDrawableImpl: Balance createHandle()/destroyHandle()
- updateHandle() -> createHandle()
- ensure both are balance, see below
GLDrawableImpl: Handle LOCK_SURFACE_CHANGED in GLDrawableImpl's lockSurface()
- call destroyHandle() and createHandle()
GLContextImpl.makeCurrent(): Validate drawable handle if realized only.
- it is valid to have an invalid drawable handle if not realized (see above)
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLContextImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 64ade3eff..90f5a9907 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -258,7 +258,7 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"<null>"; String sgl2 = (null!=gl)?gl.getClass().getSimpleName()+", "+gl.toString():"<null>"; - Exception e = new Exception("Info: setGL (OpenGL "+getGLVersion()+"): "+Thread.currentThread().getName()+", "+sgl1+" -> "+sgl2); + Exception e = new Exception("Info: setGL (OpenGL "+getGLVersion()+"): "+getThreadName()+", "+sgl1+" -> "+sgl2); e.printStackTrace(); } this.gl = gl; @@ -495,14 +495,10 @@ public abstract class GLContextImpl extends GLContext { boolean unlockContextAndSurface = true; // Must be cleared if successful, otherwise finally block will release context and surface! int res = CONTEXT_NOT_CURRENT; try { - if (0 == drawable.getHandle()) { - throw new GLException("drawable has invalid handle: "+drawable); - } - if (NativeSurface.LOCK_SURFACE_CHANGED == lockRes) { - drawable.updateHandle(); - } - if ( drawable.isRealized() ) { + if ( 0 == drawable.getHandle() ) { + throw new GLException("drawable has invalid handle: "+drawable); + } lock.lock(); try { // One context can only be current by one thread, |