diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLPbufferImpl.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLPbufferImpl.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java index d667fa53a..10d5a3f27 100644 --- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java @@ -42,6 +42,8 @@ package jogamp.opengl; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; + +import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeSurface; import javax.media.opengl.GL; import javax.media.opengl.GLAnimatorControl; @@ -70,7 +72,7 @@ public class GLPbufferImpl implements GLPbuffer { public GLPbufferImpl(GLDrawableImpl pbufferDrawable, GLContext parentContext) { GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) - pbufferDrawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); + pbufferDrawable.getNativeSurface().getGraphicsConfiguration().getChosenCapabilities(); if(caps.isOnscreen()) { if(caps.isPBuffer()) { throw new IllegalArgumentException("Error: Given drawable is Onscreen and Pbuffer: "+pbufferDrawable); @@ -97,26 +99,25 @@ public class GLPbufferImpl implements GLPbuffer { return true; } - class DisposeAction implements Runnable { - public void run() { - // Lock: Covered by DestroyAction .. - drawableHelper.dispose(GLPbufferImpl.this); - } - } - DisposeAction disposeAction = new DisposeAction(); - public void destroy() { if(pbufferDrawable.isRealized()) { + final AbstractGraphicsDevice adevice = pbufferDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + if (null != context && context.isCreated()) { try { - drawableHelper.invokeGL(pbufferDrawable, context, disposeAction, null); + drawableHelper.disposeGL(GLPbufferImpl.this, pbufferDrawable, context, null); } catch (GLException gle) { gle.printStackTrace(); } - context.destroy(); + context = null; // drawableHelper.reset(); } pbufferDrawable.destroy(); + pbufferDrawable = null; + + if(null != adevice) { + adevice.close(); + } } } |