diff options
author | Sven Gothel <[email protected]> | 2012-09-21 08:28:42 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-09-21 08:28:42 +0200 |
commit | 459af1bba130495943e51ff289a094b602c642cd (patch) | |
tree | a0c4d606dd702f3d6ded054d7c4a52ae2f109797 /src | |
parent | 5b378cb2cd162cb9af44812c37935eb3a83aabd2 (diff) |
MacOSXCGLContext: Fix missing initialization of 'needsSetContextPBuffer' if not offscreen-layer.
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 8 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java | 4 |
2 files changed, 7 insertions, 5 deletions
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)); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java index bebe3531e..60803433d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java @@ -61,6 +61,8 @@ public class TestGPUMemSec01NEWT extends UITestCase { new GLCapabilities(glp), width, height, true); final GL gl = winctx.context.getGL(); + // System.err.println("Pre GL Error: 0x"+Integer.toHexString(gl.glGetError())); + // System.err.println(winctx.drawable); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // misc GL setup @@ -249,7 +251,7 @@ public class TestGPUMemSec01NEWT extends UITestCase { NEWTGLContext.destroyWindow(winctx); } - + @Test public void testReadPixelsGL_99x100xRGBxUB() throws InterruptedException { GLProfile glp = GLProfile.getGL2ES2(); |