aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-07-15 14:35:02 +0200
committerSven Gothel <[email protected]>2023-07-15 14:35:02 +0200
commitbe9c3e42e618148584689a1ccf30c8c3f4e6227a (patch)
tree6daa57deb2ba89640c44da0a75bcada528c04570 /src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
parentddbffc38f001e3297d560ab1f6b3e7575771bdc5 (diff)
Add {GL, GLContext}.getDefaultDrawBuffer() to complement getDefaultReadBuffer()
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableImpl.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index 98a0a0948..4e0f5eaca 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -257,6 +257,17 @@ public abstract class GLDrawableImpl implements GLDrawable {
protected int getDefaultDrawFramebuffer() { return 0; }
/** 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 draw buffer of current framebuffer. */
+ protected int getDefaultDrawBuffer(final GL gl) {
+ if( gl.isGLES() || getChosenGLCapabilities().getDoubleBuffered() ) {
+ // Note-1: Neither ES1 nor ES2 supports selecting the read buffer via glDrawBuffer
+ // Note-2: ES3 only supports GL_BACK, GL_NONE or GL_COLOR_ATTACHMENT0+i
+ return GL.GL_BACK;
+ }
+ return GL.GL_FRONT;
+ }
+
/** Callback for special implementations, allowing GLContext to fetch a custom default read buffer of current framebuffer. */
protected int getDefaultReadBuffer(final GL gl, final boolean hasDedicatedDrawableRead) {
if( gl.isGLES() || hasDedicatedDrawableRead || getChosenGLCapabilities().getDoubleBuffered() ) {