diff options
author | Sven Göthel <[email protected]> | 2024-01-13 23:33:59 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-13 23:33:59 +0100 |
commit | 3062f72c7b83cef71d8e6d471846449aba66d861 (patch) | |
tree | 121927aa2faad49f6140713805c05fa40b829453 /src/jogl/classes/com/jogamp/opengl | |
parent | b886aaabf6a9c2c2ab3d03a56c3c134307fbfba4 (diff) |
GLReadBufferUtil: Allow passing a custom GL read-buffer name, useful to read FBO attachments (GL_COLOR_ATTACHMENTi)
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java index ce4f451e0..a4a48cff4 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java @@ -59,6 +59,7 @@ public class GLReadBufferUtil { protected boolean hasAlpha; protected GLPixelBuffer readPixelBuffer = null; protected TextureData readTextureData = null; + protected int readBuffer = -1; /** * Using the default {@link GLPixelBuffer}: {@link GLPixelBuffer#defaultProviderNoRowStride}. @@ -83,6 +84,8 @@ public class GLReadBufferUtil { this.hasAlpha = requestAlpha; // preset } + public void setReadBuffer(final int name) { readBuffer = name; } + /** Returns the {@link GLPixelBufferProvider} used by this instance. */ public GLPixelBufferProvider getPixelBufferProvider() { return pixelBufferProvider; } @@ -239,7 +242,11 @@ public class GLReadBufferUtil { if(gl.isGL2ES3()) { final GL2ES3 gl2es3 = gl.getGL2ES3(); psm.setPackRowLength(gl2es3, width); - gl2es3.glReadBuffer(gl2es3.getDefaultReadBuffer()); + if( 0 > readBuffer ) { + gl2es3.glReadBuffer(gl2es3.getDefaultReadBuffer()); + } else { + gl2es3.glReadBuffer(readBuffer); + } } readPixelBuffer.clear(); try { |