aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index ac76cfe6c..dd41be930 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -77,25 +77,31 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// semantic is that contains an NSView
protected long pBuffer;
- public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target) {
- super(factory, target, true);
+ public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target, boolean realizeNow) {
+ super(factory, target, false);
if (DEBUG) {
System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration());
}
- createPbuffer();
+ if(realizeNow) {
+ setRealized(true);
+ }
if (DEBUG) {
System.err.println("Created pbuffer " + this);
}
}
+ protected void destroyImpl() {
+ setRealized(false);
+ }
+
protected void setRealizedImpl() {
if(realized) {
createPbuffer();
} else {
- destroyImpl();
+ destroyPbuffer();
}
}
@@ -103,15 +109,6 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
return new MacOSXPbufferCGLContext(this, shareWith);
}
- protected void destroyImpl() {
- if (this.pBuffer != 0) {
- NativeSurface ns = getNativeSurface();
- impl.destroy(pBuffer);
- this.pBuffer = 0;
- ((SurfaceChangeable)ns).setSurfaceHandle(0);
- }
- }
-
@Override
protected long getNSViewHandle() {
// pbuffer handle is NSOpenGLPixelBuffer
@@ -129,6 +126,15 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
}
}
+ protected void destroyPbuffer() {
+ if (this.pBuffer != 0) {
+ NativeSurface ns = getNativeSurface();
+ impl.destroy(pBuffer);
+ this.pBuffer = 0;
+ ((SurfaceChangeable)ns).setSurfaceHandle(0);
+ }
+ }
+
private void createPbuffer() {
NativeSurface ns = getNativeSurface();
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();