diff options
author | Sven Gothel <[email protected]> | 2012-06-29 04:15:21 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-06-29 04:15:21 +0200 |
commit | 0d7c3ed619044723cf561df424eac9992e5281c7 (patch) | |
tree | 3ffa52aa71536a3321b9bf7e59de7ee28ede5917 /src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | |
parent | d10c7916a2444b6cb1cf45be3ccb3d6e91a2f1b4 (diff) |
GLContextImpl/GLDrawableImpl: More fail-safe, cleanup, mark some methods final
GLContextImpl: Cleanup
- release(): simplify the conditions
- destroy(): allow locked twice before (destroy case)
GLDrawableImpl:
- fail safe: swapBuffers
- final methods: getFactoryImpl, toHexString, getGLProfile, getRequestedGLCapabilities,
getFactory, isRealized, lockSurface, unlockSurface
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index c843e5571..b3884830a 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -66,7 +66,7 @@ public abstract class GLDrawableImpl implements GLDrawable { */ public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(); - public GLDrawableFactoryImpl getFactoryImpl() { + public final GLDrawableFactoryImpl getFactoryImpl() { return (GLDrawableFactoryImpl) getFactory(); } @@ -86,6 +86,9 @@ public abstract class GLDrawableImpl implements GLDrawable { @Override public final void swapBuffers() throws GLException { + if( !realized ) { + return; // destroyed already + } GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)surface.getGraphicsConfiguration().getChosenCapabilities(); if ( caps.getDoubleBuffered() ) { if(!surface.surfaceSwap()) { @@ -112,12 +115,12 @@ public abstract class GLDrawableImpl implements GLDrawable { } protected abstract void swapBuffersImpl(); - public static String toHexString(long hex) { + public final static String toHexString(long hex) { return "0x" + Long.toHexString(hex); } @Override - public GLProfile getGLProfile() { + public final GLProfile getGLProfile() { return requestedCapabilities.getGLProfile(); } @@ -126,7 +129,7 @@ public abstract class GLDrawableImpl implements GLDrawable { return (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities(); } - public GLCapabilitiesImmutable getRequestedGLCapabilities() { + public final GLCapabilitiesImmutable getRequestedGLCapabilities() { return requestedCapabilities; } @@ -147,7 +150,7 @@ public abstract class GLDrawableImpl implements GLDrawable { } @Override - public GLDrawableFactory getFactory() { + public final GLDrawableFactory getFactory() { return factory; } @@ -187,7 +190,7 @@ public abstract class GLDrawableImpl implements GLDrawable { protected abstract void setRealizedImpl(); @Override - public synchronized boolean isRealized() { + public final synchronized boolean isRealized() { return realized; } @@ -201,11 +204,11 @@ public abstract class GLDrawableImpl implements GLDrawable { return surface.getHeight(); } - public int lockSurface() throws GLException { + public final int lockSurface() throws GLException { return surface.lockSurface(); } - public void unlockSurface() { + public final void unlockSurface() { surface.unlockSurface(); } |