From 459af1bba130495943e51ff289a094b602c642cd Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 21 Sep 2012 08:28:42 +0200
Subject: MacOSXCGLContext: Fix missing initialization of
 'needsSetContextPBuffer' if not offscreen-layer.

---
 src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/jogl/classes/jogamp')

diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 929ac00c2..eae365925 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -488,6 +488,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
                   throw new RuntimeException("Anonymous drawable instance's handle neither NSView, NSWindow nor PBuffer: "+toHexString(drawableHandle)+", "+drawable.getClass().getName()+",\n\t"+drawable);
               }
           }
+          needsSetContextPBuffer = isPBuffer;
           backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
 
           boolean incompleteView = null != backingLayerHost;
@@ -600,11 +601,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl
                           public void swapBuffers(boolean doubleBuffered) {
                               MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers();                            
                           } } ) ;                    
-                  } else if( chosenCaps.isPBuffer() && CGL.isNSOpenGLPixelBuffer(drawableHandle) ) {
+                  } else if( CGL.isNSOpenGLPixelBuffer(drawableHandle) ) {
                       texID = 0;
                       pbufferHandle = drawableHandle;
                       if(0 != drawableHandle) { // complete 'validatePBufferConfig(..)' procedure
                           CGL.setContextPBuffer(ctx, pbufferHandle);
+                          needsSetContextPBuffer = false;
                       }
                   } else {
                       throw new GLException("BackingLayerHost w/ unknown handle (!FBO, !PBuffer): "+drawable);
@@ -652,9 +654,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
           if( needsSetContextPBuffer && 0 != drawableHandle && CGL.isNSOpenGLPixelBuffer(drawableHandle) ) {
               // Must associate the pbuffer with our newly-created context
               needsSetContextPBuffer = false;
-              if(0 != drawableHandle) {
-                  CGL.setContextPBuffer(ctx, drawableHandle);
-              }
+              CGL.setContextPBuffer(ctx, drawableHandle);
               if(DEBUG) {
                   System.err.println("NS.validateDrawableConfig bind pbuffer "+toHexString(drawableHandle)+" -> ctx "+toHexString(ctx)); 
               }
-- 
cgit v1.2.3