diff options
author | Sven Gothel <[email protected]> | 2012-07-09 17:08:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-07-09 17:08:45 +0200 |
commit | 3988e3d7df9b80e9b7058f64758b34a5389f38b0 (patch) | |
tree | f5ac80b9f1c67a3c4363da01fb5c475df709de5b | |
parent | 72a84b422327c6abb688339419d3552ec0e5c70c (diff) |
GLCapabilities*: Add 'isFBO()' and 'setFBO(boolean)', allowing upcoming impl. to select offscreen FBO (GLDrawable, ..)
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLCapabilities.java | 48 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java | 5 |
2 files changed, 44 insertions, 9 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java index 61ab2e58d..e5258bcfd 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java @@ -55,8 +55,9 @@ import javax.media.nativewindow.CapabilitiesImmutable; It currently contains the minimal number of routines which allow configuration on all supported window systems. */ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabilitiesImmutable { - private GLProfile glProfile = null; - private boolean pbuffer = false; + private GLProfile glProfile = null; + private boolean isPBuffer = false; + private boolean isFBO = false; private boolean doubleBuffered = true; private boolean stereo = false; private boolean hardwareAccelerated = true; @@ -105,7 +106,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil public int hashCode() { // 31 * x == (x << 5) - x int hash = 31 + this.glProfile.hashCode() ; - hash = ((hash << 5) - hash) + ( this.pbuffer ? 1 : 0 ); + hash = ((hash << 5) - hash) + ( this.isFBO ? 1 : 0 ); + hash = ((hash << 5) - hash) + ( this.isPBuffer ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.stereo ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.hardwareAccelerated ? 1 : 0 ); hash = ((hash << 5) - hash) + this.depthBits; @@ -132,7 +134,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil GLCapabilitiesImmutable other = (GLCapabilitiesImmutable)obj; boolean res = super.equals(obj) && other.getGLProfile()==glProfile && - other.isPBuffer()==pbuffer && + other.isPBuffer()==isPBuffer && + other.isFBO()==isFBO && other.getStereo()==stereo && other.getHardwareAccelerated()==hardwareAccelerated && other.getDepthBits()==depthBits && @@ -222,19 +225,44 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil @Override public final boolean isPBuffer() { - return pbuffer; + return isPBuffer; } /** - * Enables or disables pbuffer usage.<br> - * If enabled this method also invokes {@link #setOnscreen(int) setOnscreen(false)}<br> + * Enables or disables pbuffer usage. + * <p> + * If enabled this method also invokes {@link #setOnscreen(int) setOnscreen(false)} + * and {@link #setFBO(int) setFBO(false)}<br> + * </p> * Defaults to false. */ public void setPBuffer(boolean enable) { if(enable) { setOnscreen(false); + setFBO(false); } - pbuffer = enable; + isPBuffer = enable; + } + + @Override + public final boolean isFBO() { + return isFBO; + } + + /** + * Enables or disables FBO usage. + * <p> + * If enabled this method also invokes {@link #setOnscreen(int) setOnscreen(false)} + * and {@link #setPBuffer(int) setPBuffer(false)}<br> + * </p> + * Defaults to false. + */ + public void setFBO(boolean enable) { + if(enable) { + setOnscreen(false); + setPBuffer(false); + } + isFBO = enable; } /** @@ -462,7 +490,9 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } sink.append(glProfile); if(!isOnscreen()) { - if(pbuffer) { + if(isFBO) { + sink.append(", fbo"); + } else if(isPBuffer) { sink.append(", pbuffer [r2t ").append(pbufferRenderToTexture?1:0) .append(", r2tr ").append(pbufferRenderToTextureRectangle?1:0) .append(", float ").append(pbufferFloatingPointBuffers?1:0) diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java index 5f8795edc..883f3912e 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java @@ -148,6 +148,11 @@ public interface GLCapabilitiesImmutable extends CapabilitiesImmutable { */ boolean isPBuffer(); + /** + * Indicates whether FBO is used/requested. + */ + boolean isFBO(); + @Override boolean equals(Object obj); |