aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLPbufferImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLPbufferImpl.java39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
index a8277fd71..32f4cb696 100644
--- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
@@ -42,10 +42,14 @@ package jogamp.opengl;
import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import javax.media.opengl.GLPbuffer;
+import com.jogamp.common.util.locks.LockFactory;
+import com.jogamp.common.util.locks.RecursiveLock;
+
/** Platform-independent class exposing pbuffer functionality to
applications. This class is not exposed in the public API as it
would probably add no value; however it implements the GLDrawable
@@ -54,9 +58,8 @@ import javax.media.opengl.GLPbuffer;
public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
private int floatMode;
- public GLPbufferImpl(GLDrawableImpl pbufferDrawable,
- GLContext sharedContext) {
- super(pbufferDrawable, null); // drawable := pbufferDrawable
+ public GLPbufferImpl(GLDrawableImpl pbufferDrawable, GLContext sharedContext, boolean ownDevice) {
+ super(pbufferDrawable, null, ownDevice); // drawable := pbufferDrawable
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)
drawable.getNativeSurface().getGraphicsConfiguration().getChosenCapabilities();
@@ -102,7 +105,7 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
//
// GLDrawable delegation
//
-
+
@Override
public final void setRealized(boolean realized) {
}
@@ -110,10 +113,19 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
//
// GLAutoDrawable completion
//
+ private final RecursiveLock lock = LockFactory.createRecursiveLock(); // instance wide lock
+
+ @Override
+ protected final RecursiveLock getLock() { return lock; }
+
+ @Override
+ public final Object getUpstreamWidget() {
+ return null;
+ }
@Override
public void destroy() {
- defaultDestroyOp();
+ defaultDestroy();
}
@Override
@@ -122,12 +134,23 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
}
@Override
- public void display() {
- if( null != drawable && drawable.isRealized() && null != context ) {
- helper.invokeGL(drawable, context, defaultDisplayAction, initAction);
+ public final void display() {
+ final RecursiveLock _lock = lock;
+ _lock.lock(); // sync: context/drawable could been recreated/destroyed while animating
+ try {
+ if( null != context ) {
+ helper.invokeGL(drawable, context, defaultDisplayAction, initAction);
+ }
+ } finally {
+ _lock.unlock();
}
}
+ @Override
+ public final void swapBuffers() throws GLException {
+ defaultSwapBuffers();
+ }
+
//----------------------------------------------------------------------
// Internals only below this point
//