From e99f5060d62aad25fcc37ebf50c8f2a270c9d5df Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 20 Sep 2014 16:06:56 +0200 Subject: FBObject: Fix depth- and stencil bit count selection for attachRenderbuffer(..); - Fix depth- and stencil bit count selection for attachRenderbuffer(..) - Add generic values: DEFAULT_BITS, REQUESTED_BITS, CHOSEN_BITS, MAXIMUM_BITS - Refactor depth- and stencil bit-count -> format into own method - Allow depth- and stencil bit-count select a higher bit-count if required (fix) - GLFBODrawable.FBOMODE_USE_DEPTH is deprecated, using GLCapabilities.[get|set]DepthBits(..) - It was an oversight to introduce the bit flag in the first place, since we should have used the capabilities depth bit-count - Graph Test: GLEventListenerButton shall use requested capabilities for FBO drawable. --- src/jogl/classes/javax/media/opengl/GLFBODrawable.java | 17 ++++++++++------- src/jogl/classes/javax/media/opengl/awt/GLJPanel.java | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/javax/media') diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java index e98e5cbd5..01db60b2e 100644 --- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java @@ -80,11 +80,14 @@ public interface GLFBODrawable extends GLDrawable { /** FBO Mode Bit: Use a {@link TextureAttachment} for the {@link #getColorbuffer(int) render colorbuffer} ({@link #FBOMODE_DEFAULT default}), see {@link #setFBOMode(int)}. */ public static final int FBOMODE_USE_TEXTURE = 1 << 0; - /** FBO Mode Bit: Use a depth renderbuffer ({@link #FBOMODE_DEFAULT default}), see {@link #setFBOMode(int)}. */ + /** + * FBO Mode Bit: Use a depth renderbuffer ({@link #FBOMODE_DEFAULT default}), see {@link #setFBOMode(int)}. + * @deprecated Use {@link GLCapabilities#setDepthBits(int)}! + */ public static final int FBOMODE_USE_DEPTH = 1 << 1; - /** FBO Default Mode Bit: {@link #FBOMODE_USE_TEXTURE} | {@link #FBOMODE_USE_DEPTH}. */ - public static final int FBOMODE_DEFAULT = FBOMODE_USE_TEXTURE | FBOMODE_USE_DEPTH; + /** FBO Default Mode Bit: {@link #FBOMODE_USE_TEXTURE}. */ + public static final int FBOMODE_DEFAULT = FBOMODE_USE_TEXTURE; /** * @return true if initialized, i.e. a {@link GLContext} is bound and made current once, otherwise false. @@ -101,8 +104,8 @@ public interface GLFBODrawable extends GLDrawable { * {@link #FBOMODE_USE_TEXTURE} is always added at initialization. *

* - * @param modeBits custom FBO mode bits like {@link #FBOMODE_USE_TEXTURE} and {@link #FBOMODE_USE_DEPTH}. - * @throws IllegalStateException if the underlying FBO is already {@link #isInitialized()}. + * @param modeBits custom FBO mode bits like {@link #FBOMODE_USE_TEXTURE}. + * @throws IllegalStateException if already initialized, see {@link #isInitialized()}. */ void setFBOMode(final int modeBits) throws IllegalStateException; @@ -155,9 +158,9 @@ public interface GLFBODrawable extends GLDrawable { * Must be called before {@link #isInitialized() initialization}, otherwise an exception is thrown. *

* @return the new number of buffers (FBO) used, maybe different than the requested bufferCount (see above) - * @throws GLException if already initialized, see {@link #isInitialized()}. + * @throws IllegalStateException if already initialized, see {@link #isInitialized()}. */ - int setNumBuffers(final int bufferCount) throws GLException; + int setNumBuffers(final int bufferCount) throws /* IllegalStateException, */ GLException; /** * @return the number of buffers (FBO) being used. 1 if not using {@link GLCapabilities#getDoubleBuffered() double buffering}, diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 132367102..5bc4c9a60 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -1663,7 +1663,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing final boolean useGLSLFlip_pre = flipVertical && offscreenIsFBO && reqOffscreenCaps.getGLProfile().isGL2ES2() && USE_GLSL_TEXTURE_RASTERIZER; if( offscreenIsFBO && !useGLSLFlip_pre ) { // Texture attachment only required for GLSL vertical flip, hence simply use a color-renderbuffer attachment. - ((GLFBODrawable)offscreenDrawable).setFBOMode(GLFBODrawable.FBOMODE_USE_DEPTH); + ((GLFBODrawable)offscreenDrawable).setFBOMode(0); } offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith[0]); -- cgit v1.2.3