From 6c72b1fc68e65bc0d4a0ee1e0442cc1637a67d01 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 14 Aug 2013 23:32:22 +0200 Subject: Fix Bug 815: GL*: Change glIsEnabled() -> glIsBound() to reflect semanics - Also fix the exception message (enabled/disabled -> bound/unbound) Reason of change: Avoid confusion and point to the cause! API change: glIsVBOArrayEnabled() -> glIsVBOArrayBound() glIsVBOElementArrayEnabled() -> glIsVBOElementArrayBound() glIsPBOPackEnabled() -> glIsPBOPackBound() glIsPBOUnpackEnabled() -> glIsPBOUnpackBound() Exception message change: "must be enabled to call this method" -> "must be bound to call this method" "must be disabled to call this method" -> "must be unbound to call this method" --- make/config/jogl/gl-if-CustomJavaCode-es3.java | 4 +- .../config/jogl/gl-impl-CustomJavaCode-common.java | 8 ++-- make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java | 50 +++++++++++----------- make/config/jogl/gl-impl-CustomJavaCode-gles1.java | 32 +++++++------- make/config/jogl/gl-impl-CustomJavaCode-gles3.java | 50 +++++++++++----------- .../com/jogamp/gluegen/opengl/GLConfiguration.java | 4 +- src/jogl/classes/javax/media/opengl/GLBase.java | 4 +- .../opengl/util/glsl/fixedfunc/FixedFuncHook.java | 16 +++---- 8 files changed, 84 insertions(+), 84 deletions(-) diff --git a/make/config/jogl/gl-if-CustomJavaCode-es3.java b/make/config/jogl/gl-if-CustomJavaCode-es3.java index 0a1c43085..b68b5123a 100644 --- a/make/config/jogl/gl-if-CustomJavaCode-es3.java +++ b/make/config/jogl/gl-if-CustomJavaCode-es3.java @@ -8,7 +8,7 @@ public static final long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFL ; /** Part of GL_ARB_shader_image_load_store */ public static final int GL_ALL_BARRIER_BITS = 0xFFFFFFFF ; -public boolean glIsPBOPackEnabled(); +public boolean glIsPBOPackBound(); -public boolean glIsPBOUnpackEnabled(); +public boolean glIsPBOUnpackBound(); diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java index 2254e5f0b..b8da61065 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-common.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -15,13 +15,13 @@ } @Override - public final boolean glIsVBOArrayEnabled() { - return checkArrayVBOEnabled(false); + public final boolean glIsVBOArrayBound() { + return checkArrayVBOBound(false); } @Override - public final boolean glIsVBOElementArrayEnabled() { - return checkElementVBOEnabled(false); + public final boolean glIsVBOElementArrayBound() { + return checkElementVBOBound(false); } @Override diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java index 6cec06d04..e4959a32d 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -280,14 +280,14 @@ private boolean haveARBVertexArrayObject; private final boolean checkBufferObject(boolean extensionAvail, boolean allowVAO, - boolean enabled, + boolean bound, int state, String kind, boolean throwException) { if ( inBeginEndPair ) { throw new GLException("May not call this between glBegin and glEnd"); } if ( !extensionAvail ) { - if ( !enabled ) { + if ( !bound ) { return true; } if(throwException) { @@ -296,7 +296,7 @@ private final boolean checkBufferObject(boolean extensionAvail, return false; } int buffer = bufferStateTracker.getBoundBufferObject(state, this); - if ( enabled ) { + if ( bound ) { if ( 0 != buffer ) { return true; } @@ -307,7 +307,7 @@ private final boolean checkBufferObject(boolean extensionAvail, } } if ( throwException ) { - throw new GLException(kind + " must be enabled to call this method"); + throw new GLException(kind + " must be bound to call this method"); } return false; } else { @@ -315,84 +315,84 @@ private final boolean checkBufferObject(boolean extensionAvail, return true; } if ( throwException ) { - throw new GLException(kind + " must be disabled to call this method"); + throw new GLException(kind + " must be unbound to call this method"); } return false; } } -private final boolean checkArrayVBODisabled(boolean throwException) { +private final boolean checkArrayVBOUnbound(boolean throwException) { return checkBufferObject(haveGL15 || haveARBVertexBufferObject, haveARBVertexArrayObject, // allowVAO - false, // enable + false, // bound GL.GL_ARRAY_BUFFER, "array vertex_buffer_object", throwException); } -private final boolean checkArrayVBOEnabled(boolean throwException) { +private final boolean checkArrayVBOBound(boolean throwException) { return checkBufferObject(haveGL15 || haveARBVertexBufferObject, haveARBVertexArrayObject, // allowVAO - true, // enable + true, // bound GL.GL_ARRAY_BUFFER, "array vertex_buffer_object", throwException); } -private final boolean checkElementVBODisabled(boolean throwException) { +private final boolean checkElementVBOUnbound(boolean throwException) { return checkBufferObject(haveGL15 || haveARBVertexBufferObject, haveARBVertexArrayObject, // allowVAO - false, // enable + false, // bound GL.GL_ELEMENT_ARRAY_BUFFER, "element vertex_buffer_object", throwException); } -private final boolean checkElementVBOEnabled(boolean throwException) { +private final boolean checkElementVBOBound(boolean throwException) { return checkBufferObject(haveGL15 || haveARBVertexBufferObject, haveARBVertexArrayObject, // allowVAO - true, // enable + true, // bound GL.GL_ELEMENT_ARRAY_BUFFER, "element vertex_buffer_object", throwException); } -private final boolean checkUnpackPBODisabled(boolean throwException) { +private final boolean checkUnpackPBOUnbound(boolean throwException) { return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject, false, // allowVAO - false, // enable + false, // bound GL2.GL_PIXEL_UNPACK_BUFFER, "unpack pixel_buffer_object", throwException); } -private final boolean checkUnpackPBOEnabled(boolean throwException) { +private final boolean checkUnpackPBOBound(boolean throwException) { return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject, false, // allowVAO - true, // enable + true, // bound GL2.GL_PIXEL_UNPACK_BUFFER, "unpack pixel_buffer_object", throwException); } -private final boolean checkPackPBODisabled(boolean throwException) { +private final boolean checkPackPBOUnbound(boolean throwException) { return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject, false, // allowVAO - false, // enable + false, // bound GL2.GL_PIXEL_PACK_BUFFER, "pack pixel_buffer_object", throwException); } -private final boolean checkPackPBOEnabled(boolean throwException) { +private final boolean checkPackPBOBound(boolean throwException) { return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject, false, // allowVAO - true, // enable + true, // bound GL2.GL_PIXEL_PACK_BUFFER, "pack pixel_buffer_object", throwException); } @Override -public final boolean glIsPBOPackEnabled() { - return checkPackPBOEnabled(false); +public final boolean glIsPBOPackBound() { + return checkPackPBOBound(false); } @Override -public final boolean glIsPBOUnpackEnabled() { - return checkUnpackPBOEnabled(false); +public final boolean glIsPBOUnpackBound() { + return checkUnpackPBOBound(false); } /** Entry point to C language function: void * {@native glMapBuffer}(GLenum target, GLenum access);
Part of GL_VERSION_1_5; GL_OES_mapbuffer */ diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index 35e8b0916..5d0af6913 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -190,21 +190,21 @@ private final GLBufferSizeTracker bufferSizeTracker; private final GLBufferStateTracker bufferStateTracker; private final GLStateTracker glStateTracker; -private final boolean checkBufferObject(boolean enabled, +private final boolean checkBufferObject(boolean bound, int state, String kind, boolean throwException) { final int buffer = bufferStateTracker.getBoundBufferObject(state, this); - if (enabled) { + if (bound) { if (0 == buffer) { if(throwException) { - throw new GLException(kind + " must be enabled to call this method"); + throw new GLException(kind + " must be bound to call this method"); } return false; } } else { if (0 != buffer) { if(throwException) { - throw new GLException(kind + " must be disabled to call this method"); + throw new GLException(kind + " must be unbound to call this method"); } return false; } @@ -212,46 +212,46 @@ private final boolean checkBufferObject(boolean enabled, return true; } -private final boolean checkArrayVBODisabled(boolean throwException) { - return checkBufferObject(false, // enabled +private final boolean checkArrayVBOUnbound(boolean throwException) { + return checkBufferObject(false, // bound GL.GL_ARRAY_BUFFER, "array vertex_buffer_object", throwException); } -private final boolean checkArrayVBOEnabled(boolean throwException) { - return checkBufferObject(true, // enabled +private final boolean checkArrayVBOBound(boolean throwException) { + return checkBufferObject(true, // bound GL.GL_ARRAY_BUFFER, "array vertex_buffer_object", throwException); } -private final boolean checkElementVBODisabled(boolean throwException) { - return checkBufferObject(false, // enabled +private final boolean checkElementVBOUnbound(boolean throwException) { + return checkBufferObject(false, // bound GL.GL_ELEMENT_ARRAY_BUFFER, "element vertex_buffer_object", throwException); } -private final boolean checkElementVBOEnabled(boolean throwException) { - return checkBufferObject(true, // enabled +private final boolean checkElementVBOBound(boolean throwException) { + return checkBufferObject(true, // bound GL.GL_ELEMENT_ARRAY_BUFFER, "element vertex_buffer_object", throwException); } -private final boolean checkUnpackPBODisabled(boolean throwException) { +private final boolean checkUnpackPBOUnbound(boolean throwException) { // PBO n/a for ES 1.1 or ES 2.0 return true; } -private final boolean checkUnpackPBOEnabled(boolean throwException) { +private final boolean checkUnpackPBOBound(boolean throwException) { // PBO n/a for ES 1.1 or ES 2.0 return false; } -private final boolean checkPackPBODisabled(boolean throwException) { +private final boolean checkPackPBOUnbound(boolean throwException) { // PBO n/a for ES 1.1 or ES 2.0 return true; } -private final boolean checkPackPBOEnabled(boolean throwException) { +private final boolean checkPackPBOBound(boolean throwException) { // PBO n/a for ES 1.1 or ES 2.0 return false; } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java index a03352409..ca15f4718 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java @@ -201,11 +201,11 @@ private final GLStateTracker glStateTracker; private final boolean checkBufferObject(boolean extensionAvail, boolean allowVAO, - boolean enabled, + boolean bound, int state, String kind, boolean throwException) { if ( !extensionAvail ) { - if ( !enabled ) { + if ( !bound ) { return true; } if(throwException) { @@ -214,7 +214,7 @@ private final boolean checkBufferObject(boolean extensionAvail, return false; } int buffer = bufferStateTracker.getBoundBufferObject(state, this); - if ( enabled ) { + if ( bound ) { if ( 0 != buffer ) { return true; } @@ -225,7 +225,7 @@ private final boolean checkBufferObject(boolean extensionAvail, } } if ( throwException ) { - throw new GLException(kind + " must be enabled to call this method"); + throw new GLException(kind + " must be bound to call this method"); } return false; } else { @@ -233,84 +233,84 @@ private final boolean checkBufferObject(boolean extensionAvail, return true; } if ( throwException ) { - throw new GLException(kind + " must be disabled to call this method"); + throw new GLException(kind + " must be unbound to call this method"); } return false; } } -private final boolean checkArrayVBODisabled(boolean throwException) { +private final boolean checkArrayVBOUnbound(boolean throwException) { return checkBufferObject(true, _isES3, // allowVAO - false, // enable + false, // bound GL.GL_ARRAY_BUFFER, "array vertex_buffer_object", throwException); } -private final boolean checkArrayVBOEnabled(boolean throwException) { +private final boolean checkArrayVBOBound(boolean throwException) { return checkBufferObject(true, _isES3, // allowVAO - true, // enable + true, // bound GL.GL_ARRAY_BUFFER, "array vertex_buffer_object", throwException); } -private final boolean checkElementVBODisabled(boolean throwException) { +private final boolean checkElementVBOUnbound(boolean throwException) { return checkBufferObject(true, _isES3, // allowVAO - false, // enable + false, // bound GL.GL_ELEMENT_ARRAY_BUFFER, "element vertex_buffer_object", throwException); } -private final boolean checkElementVBOEnabled(boolean throwException) { +private final boolean checkElementVBOBound(boolean throwException) { return checkBufferObject(true, _isES3, // allowVAO - true, // enable + true, // bound GL.GL_ELEMENT_ARRAY_BUFFER, "element vertex_buffer_object", throwException); } -private final boolean checkUnpackPBODisabled(boolean throwException) { +private final boolean checkUnpackPBOUnbound(boolean throwException) { return checkBufferObject(_isES3, false, // allowVAO - false, // enable + false, // bound GL2.GL_PIXEL_UNPACK_BUFFER, "unpack pixel_buffer_object", throwException); } -private final boolean checkUnpackPBOEnabled(boolean throwException) { +private final boolean checkUnpackPBOBound(boolean throwException) { return checkBufferObject(_isES3, false, // allowVAO - true, // enable + true, // bound GL2.GL_PIXEL_UNPACK_BUFFER, "unpack pixel_buffer_object", throwException); } -private final boolean checkPackPBODisabled(boolean throwException) { +private final boolean checkPackPBOUnbound(boolean throwException) { return checkBufferObject(_isES3, false, // allowVAO - false, // enable + false, // bound GL2.GL_PIXEL_PACK_BUFFER, "pack pixel_buffer_object", throwException); } -private final boolean checkPackPBOEnabled(boolean throwException) { +private final boolean checkPackPBOBound(boolean throwException) { return checkBufferObject(_isES3, false, // allowVAO - true, // enable + true, // bound GL2.GL_PIXEL_PACK_BUFFER, "pack pixel_buffer_object", throwException); } @Override -public final boolean glIsPBOPackEnabled() { - return checkPackPBOEnabled(false); +public final boolean glIsPBOPackBound() { + return checkPackPBOBound(false); } @Override -public final boolean glIsPBOUnpackEnabled() { - return checkUnpackPBOEnabled(false); +public final boolean glIsPBOUnpackBound() { + return checkUnpackPBOBound(false); } /** Entry point to C language function: void * {@native glMapBuffer}(GLenum target, GLenum access);
Part of GL_VERSION_1_5; GL_OES_mapbuffer */ diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java index d4dca715b..7fdb93e9b 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java @@ -176,9 +176,9 @@ public class GLConfiguration extends ProcAddressConfiguration { } if (emitter.isBufferObjectMethodBinding(binding)) { - prologue = prologue + "Enabled"; + prologue = prologue + "Bound"; } else { - prologue = prologue + "Disabled"; + prologue = prologue + "Unbound"; } prologue = prologue + "(true);"; diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java index f1853351f..a9de70698 100644 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ b/src/jogl/classes/javax/media/opengl/GLBase.java @@ -508,12 +508,12 @@ public interface GLBase { /** * @return true if a VBO is bound to {@link GL.GL_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false */ - public boolean glIsVBOArrayEnabled(); + public boolean glIsVBOArrayBound(); /** * @return true if a VBO is bound to {@link GL.GL_ELEMENT_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false */ - public boolean glIsVBOElementArrayEnabled(); + public boolean glIsVBOElementArrayBound(); /** * Return the framebuffer name bound to this context, diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java index 351d7a110..6d5b16def 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java @@ -325,11 +325,11 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun public void glVertexPointer(GLArrayData array) { if(array.isVBO()) { - if(!gl.glIsVBOArrayEnabled()) { + if(!gl.glIsVBOArrayBound()) { throw new GLException("VBO array is not enabled: "+array); } } else { - if(gl.glIsVBOArrayEnabled()) { + if(gl.glIsVBOArrayBound()) { throw new GLException("VBO array is not disabled: "+array); } Buffers.rangeCheck(array.getBuffer(), 1); @@ -354,11 +354,11 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun public void glColorPointer(GLArrayData array) { if(array.isVBO()) { - if(!gl.glIsVBOArrayEnabled()) { + if(!gl.glIsVBOArrayBound()) { throw new GLException("VBO array is not enabled: "+array); } } else { - if(gl.glIsVBOArrayEnabled()) { + if(gl.glIsVBOArrayBound()) { throw new GLException("VBO array is not disabled: "+array); } Buffers.rangeCheck(array.getBuffer(), 1); @@ -385,11 +385,11 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun throw new GLException("Only 3 components per normal allowed"); } if(array.isVBO()) { - if(!gl.glIsVBOArrayEnabled()) { + if(!gl.glIsVBOArrayBound()) { throw new GLException("VBO array is not enabled: "+array); } } else { - if(gl.glIsVBOArrayEnabled()) { + if(gl.glIsVBOArrayBound()) { throw new GLException("VBO array is not disabled: "+array); } Buffers.rangeCheck(array.getBuffer(), 1); @@ -413,11 +413,11 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun public void glTexCoordPointer(GLArrayData array) { if(array.isVBO()) { - if(!gl.glIsVBOArrayEnabled()) { + if(!gl.glIsVBOArrayBound()) { throw new GLException("VBO array is not enabled: "+array); } } else { - if(gl.glIsVBOArrayEnabled()) { + if(gl.glIsVBOArrayBound()) { throw new GLException("VBO array is not disabled: "+array); } Buffers.rangeCheck(array.getBuffer(), 1); -- cgit v1.2.3