From 38f6915fedb765313c1f4646acf9e13dfbccef36 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 20 Sep 2014 21:53:26 +0200 Subject: Bug 1073: FBObject/GLFBODrawable: Remove deprecated methods - dual-use reset(..), use dedicated init(..) and reset(..) - GLFBODrawable.FBOMODE_USE_DEPTH: Use GLCapabilities.[get|set]DepthBits(int) Note: Applications shall use _requested_ GLCapabilities, if passing caps down to the GLFBODrawable. Otherwise (using _chosen_ caps) we may end up in requesting properties not desired, e.g. stencil bits, if driver has chosen. --- src/jogl/classes/com/jogamp/opengl/FBObject.java | 59 ++-------------------- .../classes/javax/media/opengl/GLFBODrawable.java | 7 +-- .../classes/jogamp/opengl/GLFBODrawableImpl.java | 4 +- 3 files changed, 6 insertions(+), 64 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index 1e2d296f4..d16bed276 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -1090,61 +1090,10 @@ public class FBObject { * @throws IllegalStateException if not initialized via {@link #init(GL, int, int, int)}. * @throws GLException in case of an error, i.e. size too big, etc .. */ - public final boolean reset(final GL gl, final int newWidth, final int newHeight, final int newSamples) throws GLException, IllegalStateException { + public final boolean reset(final GL gl, int newWidth, int newHeight, int newSamples) throws GLException, IllegalStateException { if( !initialized ) { throw new IllegalStateException("FBO not initialized"); } - return reset(gl, newWidth, newHeight, newSamples, true); - } - - /** - * Initializes or resets this FBO's instance. - *

- * In case the new parameters are compatible with the current ones - * no action will be performed. Otherwise all attachments will be recreated - * to match the new given parameters. - *

- * - *

Leaves the FBO bound state untouched

- * - * @param gl the current GL context - * @param newWidth - * @param newHeight - * @return {@code true} if this instance has been modified, otherwise {@code false}. - * @throws GLException in case of an error - * @deprecated Use {@link #init(GL, int, int, int)} or {@link #reset(GL, int, int, int)} - */ - public final boolean reset(final GL gl, final int newWidth, final int newHeight) { - return reset(gl, newWidth, newHeight, 0, false); - } - - /** - * Initializes or resets this FBO's instance. - *

- * In case the new parameters are compatible with the current ones - * no action will be performed. Otherwise all attachments will be recreated - * to match the new given parameters. - *

- * - *

Leaves the FBO bound state untouched

- * - * @param gl the current GL context - * @param newWidth the new width, it's minimum is capped to 1 - * @param newHeight the new height, it's minimum is capped to 1 - * @param newSamples if > 0, MSAA will be used, otherwise no multisampling. Will be capped to {@link #getMaxSamples()}. - * @param resetSamplingSink true calls {@link #resetSamplingSink(GL)} immediatly. - * false postpones resetting the sampling sink until {@link #use(GL, TextureAttachment)} or {@link #syncSamplingSink(GL)}, - * allowing to use the samples sink's FBO and texture until then. The latter is useful to benefit - * from implicit double buffering while resetting the sink just before it's being used, eg. at swap-buffer. - * @return {@code true} if this instance has been modified, otherwise {@code false}. - * @throws GLException in case of an error, i.e. size too big, etc .. - * @deprecated Use {@link #init(GL, int, int, int)} or {@link #reset(GL, int, int, int)} - */ - public final boolean reset(final GL gl, int newWidth, int newHeight, int newSamples, final boolean resetSamplingSink) { - if( !initialized ) { - init(gl, newWidth, newHeight, newSamples); - return true; - } newSamples = newSamples <= maxSamples ? newSamples : maxSamples; // clamp @@ -1182,9 +1131,7 @@ public class FBObject { samplingSinkDirty = true; detachAllImpl(gl, true, true, sampleCountChange); - if( resetSamplingSink ) { - resetSamplingSink(gl); - } + resetSamplingSink(gl); if(!wasBound) { unbind(gl); @@ -2508,7 +2455,7 @@ public class FBObject { * @throws GLException if this FBO doesn't use MSAA or the given sink uses MSAA itself * @throws IllegalStateException if the {@code newSamplingSink} is not null and not initialized */ - public FBObject setSamplingSink(final FBObject newSamplingSink) throws /* IllegalStateException, */ GLException { + public FBObject setSamplingSink(final FBObject newSamplingSink) throws IllegalStateException, GLException { final FBObject prev = samplingSink; if( null == newSamplingSink) { samplingSink = null; diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java index 01db60b2e..07cb723a0 100644 --- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java @@ -80,11 +80,6 @@ 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)}. - * @deprecated Use {@link GLCapabilities#setDepthBits(int)}! - */ - public static final int FBOMODE_USE_DEPTH = 1 << 1; /** FBO Default Mode Bit: {@link #FBOMODE_USE_TEXTURE}. */ public static final int FBOMODE_DEFAULT = FBOMODE_USE_TEXTURE; @@ -160,7 +155,7 @@ public interface GLFBODrawable extends GLDrawable { * @return the new number of buffers (FBO) used, maybe different than the requested bufferCount (see above) * @throws IllegalStateException if already initialized, see {@link #isInitialized()}. */ - int setNumBuffers(final int bufferCount) throws /* IllegalStateException, */ 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/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index fdd5aa5e9..72caabdd0 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -107,7 +107,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { final FBObject fbo = new FBObject(); fbos[idx] = fbo; - final boolean useDepth = depthBits > 0 || 0 != ( FBOMODE_USE_DEPTH & fboModeBits ); + final boolean useDepth = depthBits > 0; final boolean useStencil = stencilBits > 0; fbo.init(gl, width, height, samples); @@ -525,7 +525,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - public final int setNumBuffers(final int bufferCount) throws /* IllegalStateException, */ GLException { + public final int setNumBuffers(final int bufferCount) throws IllegalStateException, GLException { if( isInitialized() ) { throw new IllegalStateException("Already initialized: "+this); } -- cgit v1.2.3