summaryrefslogtreecommitdiffstats
path: root/make/config
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-14 06:28:44 +0200
committerSven Gothel <[email protected]>2013-04-14 06:28:44 +0200
commitb414c4b1be05249590138e73558ada82bd170f15 (patch)
tree0475e627f78bcb94e56306b552b15dcc157b219a /make/config
parentd7096cfeee500177db85d97241cc142af41517cb (diff)
Fix Bug 692: Add tracking of VERTEX_ARRAY_BINDING, and enable allowing a bound non default VAO to pass VBO enabled test, even if VBO is disabled.
VAO is available if: GL >= 3.0 or is having GL_ARB_vertex_array_object extension. checkBufferObject(..) checks whether VERTEX_ARRAY_BINDING has a non default VAO bound in case no VBO is being bound and VAO is allowed. glBindVertexArray(int) is being tracked, i.e. on state VERTEX_ARRAY_BINDING
Diffstat (limited to 'make/config')
-rw-r--r--make/config/jogl/gl-common.cfg1
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java138
2 files changed, 71 insertions, 68 deletions
diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg
index f8f4f07f5..a57400217 100644
--- a/make/config/jogl/gl-common.cfg
+++ b/make/config/jogl/gl-common.cfg
@@ -515,6 +515,7 @@ JavaPrologue glBegin inBeginEndPair = true;
JavaEpilogue glEnd inBeginEndPair = false;
JavaEpilogue glBindBuffer bufferStateTracker.setBoundBufferObject({0}, {1});
JavaEpilogue glBindBufferARB bufferStateTracker.setBoundBufferObject({0}, {1});
+JavaEpilogue glBindVertexArray bufferStateTracker.setBoundBufferObject(GL2GL3.GL_VERTEX_ARRAY_BINDING, {0});
JavaEpilogue glPushClientAttrib bufferStateTracker.clearBufferObjectState();
JavaEpilogue glPushClientAttrib glStateTracker.pushAttrib(mask);
JavaEpilogue glPopClientAttrib bufferStateTracker.clearBufferObjectState();
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
index e079a1a24..bfe2759c0 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
@@ -51,133 +51,135 @@ private boolean haveEXTPixelBufferObject;
private boolean haveGL15;
private boolean haveGL21;
private boolean haveARBVertexBufferObject;
+private boolean haveARBVertexArrayObject;
private final void initBufferObjectExtensionChecks() {
- if (bufferObjectExtensionsInitialized)
+ if ( bufferObjectExtensionsInitialized ) {
return;
+ }
bufferObjectExtensionsInitialized = true;
haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object");
haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object");
haveGL15 = isExtensionAvailable("GL_VERSION_1_5");
haveGL21 = isExtensionAvailable("GL_VERSION_2_1");
haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object");
+ haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version30) >= 0 ||
+ isExtensionAvailable("GL_ARB_vertex_array_object");
}
-private final boolean checkBufferObject(boolean extension1,
- boolean extension2,
- boolean extension3,
+private final boolean checkBufferObject(boolean extensionAvail,
+ boolean allowVAO,
boolean enabled,
int state,
String kind, boolean throwException) {
- if (inBeginEndPair) {
+ if ( inBeginEndPair ) {
throw new GLException("May not call this between glBegin and glEnd");
}
- boolean avail = (extension1 || extension2 || extension3);
- if (!avail) {
- if (!enabled)
+ if ( !extensionAvail ) {
+ if ( !enabled ) {
return true;
+ }
if(throwException) {
throw new GLException("Required extensions not available to call this function");
}
return false;
}
int buffer = bufferStateTracker.getBoundBufferObject(state, this);
- if (enabled) {
- if (buffer == 0) {
- if(throwException) {
- throw new GLException(kind + " must be enabled to call this method");
- }
- return false;
+ if ( enabled ) {
+ if ( 0 != buffer ) {
+ return true;
+ }
+ if ( allowVAO ) {
+ buffer = bufferStateTracker.getBoundBufferObject(GL2GL3.GL_VERTEX_ARRAY_BINDING, this);
+ if( 0 != buffer && !_context.isDefaultVAO(buffer) ) {
+ return true;
+ }
+ }
+ if ( throwException ) {
+ throw new GLException(kind + " must be enabled to call this method");
}
+ return false;
} else {
- if (buffer != 0) {
- if(throwException) {
- throw new GLException(kind + " must be disabled to call this method");
- }
- return false;
+ if ( 0 == buffer ) {
+ return true;
}
+ if ( throwException ) {
+ throw new GLException(kind + " must be disabled to call this method");
+ }
+ return false;
}
- return true;
}
private final boolean checkArrayVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- return checkBufferObject(haveGL15,
- haveARBVertexBufferObject,
- false,
- false,
- GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object", throwException);
+ return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
+ haveARBVertexArrayObject, // allowVAO
+ false, // enable
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object", throwException);
}
private final boolean checkArrayVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- return checkBufferObject(haveGL15,
- haveARBVertexBufferObject,
- false,
- true,
- GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object", throwException);
+ return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
+ haveARBVertexArrayObject, // allowVAO
+ true, // enable
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object", throwException);
}
private final boolean checkElementVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- return checkBufferObject(haveGL15,
- haveARBVertexBufferObject,
- false,
- false,
- GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object", throwException);
+ return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
+ haveARBVertexArrayObject, // allowVAO
+ false, // enable
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object", throwException);
}
private final boolean checkElementVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- return checkBufferObject(haveGL15,
- haveARBVertexBufferObject,
- false,
- true,
- GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object", throwException);
+ return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
+ haveARBVertexArrayObject, // allowVAO
+ true, // enable
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object", throwException);
}
private final boolean checkUnpackPBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- return checkBufferObject(haveARBPixelBufferObject,
- haveEXTPixelBufferObject,
- haveGL21,
- false,
- GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object", throwException);
+ return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject,
+ false, // allowVAO
+ false, // enable
+ GL2.GL_PIXEL_UNPACK_BUFFER,
+ "unpack pixel_buffer_object", throwException);
}
private final boolean checkUnpackPBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- return checkBufferObject(haveARBPixelBufferObject,
- haveEXTPixelBufferObject,
- haveGL21,
- true,
- GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object", throwException);
+ return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject,
+ false, // allowVAO
+ true, // enable
+ GL2.GL_PIXEL_UNPACK_BUFFER,
+ "unpack pixel_buffer_object", throwException);
}
private final boolean checkPackPBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- return checkBufferObject(haveARBPixelBufferObject,
- haveEXTPixelBufferObject,
- haveGL21,
- false,
- GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object", throwException);
+ return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject,
+ false, // allowVAO
+ false, // enable
+ GL2.GL_PIXEL_PACK_BUFFER,
+ "pack pixel_buffer_object", throwException);
}
private final boolean checkPackPBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- return checkBufferObject(haveARBPixelBufferObject,
- haveEXTPixelBufferObject,
- haveGL21,
- true,
- GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object", throwException);
+ return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject,
+ false, // allowVAO
+ true, // enable
+ GL2.GL_PIXEL_PACK_BUFFER,
+ "pack pixel_buffer_object", throwException);
}
@Override