diff options
author | Sven Gothel <[email protected]> | 2014-01-24 05:01:40 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-24 05:01:40 +0100 |
commit | b7f673dad7025400e445e8796305a3ea6b7c1679 (patch) | |
tree | ee95d6feb5e0977122d0d261bcae9f5bfb2141a3 /src/jogl | |
parent | 9a642c08f9ee818a89d5eab8ce16ca8e0ee7f9d9 (diff) |
Bug 950 - Recognize full FBO capabilities for ES 3.0 - [GLContext|GL].hasFullFBOSupport() == true
OpenGL ES 3.0 supports full framebuffer operations, incl. multiple color-attachments and multisample.
Hence [GLContext|GL].hasFullFBOSupport() shall returns true w/ a ES 3.0 context.
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/FBObject.java | 33 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLBase.java | 4 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 24 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 2 |
4 files changed, 32 insertions, 31 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index 72041a389..90a8dc073 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -32,6 +32,7 @@ import java.util.Arrays; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.GL3; import javax.media.opengl.GLBase; @@ -386,7 +387,7 @@ public class FBObject { gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, getName()); if( samples > 0 ) { - ((GL2GL3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples, format, getWidth(), getHeight()); + ((GL2ES3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples, format, getWidth(), getHeight()); } else { gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, format, getWidth(), getHeight()); } @@ -793,7 +794,7 @@ public class FBObject { } fullFBOSupport = gl.hasFullFBOSupport(); - rgba8Avail = gl.isGL2GL3() || gl.isExtensionAvailable(GLExtensions.OES_rgb8_rgba8); + rgba8Avail = gl.isGL2ES3() || gl.isExtensionAvailable(GLExtensions.OES_rgb8_rgba8); depth24Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_depth24); depth32Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_depth32); stencil01Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_stencil1); @@ -1044,14 +1045,14 @@ public class FBObject { return("FBO missing draw buffer"); case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: return("FBO missing read buffer"); - case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + case GL2ES3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: return("FBO missing multisample buffer"); case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS: return("FBO missing layer targets"); case GL.GL_FRAMEBUFFER_UNSUPPORTED: return("Unsupported FBO format"); - case GL2GL3.GL_FRAMEBUFFER_UNDEFINED: + case GL2ES3.GL_FRAMEBUFFER_UNDEFINED: return("FBO undefined"); case 0: @@ -1084,7 +1085,7 @@ public class FBObject { } case GL.GL_FRAMEBUFFER_UNSUPPORTED: - case GL2GL3.GL_FRAMEBUFFER_UNDEFINED: + case GL2ES3.GL_FRAMEBUFFER_UNDEFINED: case 0: default: @@ -2068,7 +2069,7 @@ public class FBObject { * * <p> * In case you have attached more than one color buffer, - * you may want to setup {@link GL2GL3#glDrawBuffers(int, int[], int)}. + * you may want to setup {@link GL2ES3#glDrawBuffers(int, int[], int)}. * </p> * @param gl the current GL context * @throws GLException @@ -2078,8 +2079,8 @@ public class FBObject { checkInitialized(); if(samples > 0 && fullFBOSupport) { // draw to multisampling - read from samplesSink - gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, getWriteFramebuffer()); - gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, getReadFramebuffer()); + gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, getWriteFramebuffer()); + gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, getReadFramebuffer()); } else { // one for all gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer()); @@ -2104,8 +2105,8 @@ public class FBObject { if(fullFBOSupport) { // default read/draw buffers, may utilize GLContext/GLDrawable override of // GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer() - gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0); - gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, 0); } else { gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer } @@ -2155,7 +2156,7 @@ public class FBObject { * </p> * <p> * In case you use this FBO w/o the {@link GLFBODrawable} and intend to employ {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer) glReadPixels(..)} - * you may want to call {@link GL#glBindFramebuffer(int, int) glBindFramebuffer}({@link GL2GL3#GL_READ_FRAMEBUFFER}, {@link #getReadFramebuffer()}); + * you may want to call {@link GL#glBindFramebuffer(int, int) glBindFramebuffer}({@link GL2ES3#GL_READ_FRAMEBUFFER}, {@link #getReadFramebuffer()}); * </p> * <p>Leaves the FBO unbound.</p> * @@ -2169,17 +2170,17 @@ public class FBObject { samplingSinkDirty = false; resetSamplingSink(gl); checkPreGLError(gl); - gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, fbName); - gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, samplingSink.getWriteFramebuffer()); - ((GL2GL3)gl).glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, // since MSAA is supported, casting to GL2GL3 is OK + gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, fbName); + gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, samplingSink.getWriteFramebuffer()); + ((GL2ES3)gl).glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, // since MSAA is supported, casting to GL2ES3 is OK GL.GL_COLOR_BUFFER_BIT, GL.GL_NEAREST); checkNoError(null, gl.glGetError(), "FBObject syncSampleSink"); // throws GLException if error } if(fullFBOSupport) { // default read/draw buffers, may utilize GLContext/GLDrawable override of // GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer() - gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0); - gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, 0); + gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, 0); } else { gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer } diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java index 3ac12f0a1..2d6aed139 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/javax/media/opengl/GLBase.java @@ -396,7 +396,7 @@ public interface GLBase { /** * Returns <code>true</code> if basic FBO support is available, otherwise <code>false</code>. * <p> - * Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions + * Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= 3.0 [core, compat] or implements the extensions * <code>GL_ARB_ES2_compatibility</code>, <code>GL_ARB_framebuffer_object</code>, <code>GL_EXT_framebuffer_object</code> or <code>GL_OES_framebuffer_object</code>. * </p> * <p> @@ -410,7 +410,7 @@ public interface GLBase { /** * Returns <code>true</code> if full FBO support is available, otherwise <code>false</code>. * <p> - * Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions + * Full FBO is supported if the context is either GL >= core 3.0 [ES, core, compat] or implements the extensions * <code>ARB_framebuffer_object</code>, or all of * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>, * <code>EXT_framebuffer_blit</code>, <code>GL_EXT_packed_depth_stencil</code>. diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 0b0ed8e0d..9245d10c2 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -883,7 +883,7 @@ public abstract class GLContext { /** * Returns <code>true</code> if basic FBO support is available, otherwise <code>false</code>. * <p> - * Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions + * Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= 3.0 [core, compat] or implements the extensions * <code>GL_ARB_ES2_compatibility</code>, <code>GL_ARB_framebuffer_object</code>, <code>GL_EXT_framebuffer_object</code> or <code>GL_OES_framebuffer_object</code>. * </p> * <p> @@ -897,18 +897,9 @@ public abstract class GLContext { } /** - * Returns <code>true</code> if <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points available, - * otherwise <code>false</code>. - * @see #CTX_IMPL_FP32_COMPAT_API - */ - public final boolean hasFP32CompatAPI() { - return 0 != ( ctxOptions & CTX_IMPL_FP32_COMPAT_API ) ; - } - - /** * Returns <code>true</code> if full FBO support is available, otherwise <code>false</code>. * <p> - * Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions + * Full FBO is supported if the context is either GL >= 3.0 [ES, core, compat] or implements the extensions * <code>ARB_framebuffer_object</code>, or all of * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>, * <code>EXT_framebuffer_blit</code>, <code>GL_EXT_packed_depth_stencil</code>. @@ -919,7 +910,7 @@ public abstract class GLContext { */ public final boolean hasFullFBOSupport() { return hasBasicFBOSupport() && !hasRendererQuirk(GLRendererQuirks.NoFullFBOSupport) && - ( isGL3() || // GL >= 3.0 + ( isGL3ES3() || // GL >= 3.0 [ES, core, compat] isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object ( isExtensionAvailable(GLExtensions.EXT_framebuffer_object) && // All EXT_framebuffer_object* isExtensionAvailable(GLExtensions.EXT_framebuffer_multisample) && @@ -930,6 +921,15 @@ public abstract class GLContext { } /** + * Returns <code>true</code> if <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points available, + * otherwise <code>false</code>. + * @see #CTX_IMPL_FP32_COMPAT_API + */ + public final boolean hasFP32CompatAPI() { + return 0 != ( ctxOptions & CTX_IMPL_FP32_COMPAT_API ) ; + } + + /** * Returns the maximum number of FBO RENDERBUFFER samples * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. */ diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index ee9f315c8..417dbd011 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1916,7 +1916,7 @@ public abstract class GLContextImpl extends GLContext { private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) { return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0 - major >= 3 || // any >= 3.0 GL ctx + major >= 3 || // any >= 3.0 GL ctx (core, compat and ES) ( null != extCache && |