From b96fc594f15fcf9ee0fd238ce8d7a10aea781d32 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 18 Feb 2014 21:49:37 +0100 Subject: GLContextImpl/GLDrawableImpl.getDefaultReadBuffer(..): Pass hint whether dedicated read-drawable is being used (double buffering) --- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 2 +- src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 4 ++-- src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl') diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index b133fc017..9ccd78589 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -2231,7 +2231,7 @@ public abstract class GLContextImpl extends GLContext { @Override public final int getDefaultReadFramebuffer() { return drawable.getDefaultReadFramebuffer(); } @Override - public final int getDefaultReadBuffer() { return drawable.getDefaultReadBuffer(gl); } + public final int getDefaultReadBuffer() { return drawable.getDefaultReadBuffer(gl, drawableRead != drawable); } //--------------------------------------------------------------------------- // GL_ARB_debug_output, GL_AMD_debug_output helpers diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index 94d39a4ab..d11274560 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -260,8 +260,8 @@ public abstract class GLDrawableImpl implements GLDrawable { /** Callback for special implementations, allowing GLContext to fetch a custom default read framebuffer. Defaults to zero. */ protected int getDefaultReadFramebuffer() { return 0; } /** Callback for special implementations, allowing GLContext to fetch a custom default read buffer of current framebuffer. */ - protected int getDefaultReadBuffer(GL gl) { - if(gl.isGLES() || getChosenGLCapabilities().getDoubleBuffered()) { + protected int getDefaultReadBuffer(GL gl, boolean hasDedicatedDrawableRead) { + if( gl.isGLES() || hasDedicatedDrawableRead || getChosenGLCapabilities().getDoubleBuffered() ) { // Note-1: Neither ES1 nor ES2 supports selecting the read buffer via glReadBuffer // Note-2: ES3 only supports GL_BACK, GL_NONE or GL_COLOR_ATTACHMENT0+i return GL.GL_BACK; diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index 0e9d142ba..6f5fa3eed 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -325,7 +325,9 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { protected final int getDefaultReadFramebuffer() { return initialized ? fbos[fboIFront].getReadFramebuffer() : 0; } @Override - protected final int getDefaultReadBuffer(GL gl) { return initialized ? fbos[fboIFront].getDefaultReadBuffer() : GL.GL_COLOR_ATTACHMENT0 ; } + protected final int getDefaultReadBuffer(GL gl, boolean hasDedicatedDrawableRead) { + return initialized ? fbos[fboIFront].getDefaultReadBuffer() : GL.GL_COLOR_ATTACHMENT0 ; + } @Override protected final void setRealizedImpl() { -- cgit v1.2.3