summaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-14 05:53:44 +0200
committerSven Gothel <[email protected]>2013-04-14 05:53:44 +0200
commit594329b4334e453a3f0b7bb6f576a6e943263f95 (patch)
treef0e781d70a2244a4a5544ddeab6883d3fcdd0ef0 /make
parentd2075cce989881ce3556e4384ab1fbdf829bc212 (diff)
GLES[12] Impl: Cleanup 'checkBufferObject(..)', remove unused and 'avail' argument and 'initBufferObjectExtensionChecks()'
Diffstat (limited to 'make')
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gles1.java59
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-gles2.java59
2 files changed, 32 insertions, 86 deletions
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
index 68eadc683..70425689a 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
@@ -140,38 +140,19 @@ private final GLBufferSizeTracker bufferSizeTracker;
private final GLBufferStateTracker bufferStateTracker;
private final GLStateTracker glStateTracker;
-private boolean bufferObjectExtensionsInitialized = false;
-private boolean haveOESFramebufferObject;
-
-private final void initBufferObjectExtensionChecks() {
- if (bufferObjectExtensionsInitialized)
- return;
- bufferObjectExtensionsInitialized = true;
- haveOESFramebufferObject = isExtensionAvailable("GL_OES_framebuffer_object");
-}
-
-private final boolean checkBufferObject(boolean avail,
- boolean enabled,
+private final boolean checkBufferObject(boolean enabled,
int state,
String kind, boolean throwException) {
- if (!avail) {
- 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);
+ final int buffer = bufferStateTracker.getBoundBufferObject(state, this);
if (enabled) {
- if (buffer == 0) {
+ if (0 == buffer) {
if(throwException) {
throw new GLException(kind + " must be enabled to call this method");
}
return false;
}
} else {
- if (buffer != 0) {
+ if (0 != buffer) {
if(throwException) {
throw new GLException(kind + " must be disabled to call this method");
}
@@ -182,35 +163,27 @@ private final boolean checkBufferObject(boolean avail,
}
private final boolean checkArrayVBODisabled(boolean throwException) {
- initBufferObjectExtensionChecks();
- return checkBufferObject(true,
- false,
- GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object", throwException);
+ return checkBufferObject(false, // enabled
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object", throwException);
}
private final boolean checkArrayVBOEnabled(boolean throwException) {
- initBufferObjectExtensionChecks();
- return checkBufferObject(true,
- true,
- GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object", throwException);
+ return checkBufferObject(true, // enabled
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object", throwException);
}
private final boolean checkElementVBODisabled(boolean throwException) {
- initBufferObjectExtensionChecks();
- return checkBufferObject(true,
- false,
- GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object", throwException);
+ return checkBufferObject(false, // enabled
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object", throwException);
}
private final boolean checkElementVBOEnabled(boolean throwException) {
- initBufferObjectExtensionChecks();
- return checkBufferObject(true,
- true,
- GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object", throwException);
+ return checkBufferObject(true, // enabled
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object", throwException);
}
private final boolean checkUnpackPBODisabled(boolean throwException) {
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java
index 760287364..37f3f33aa 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java
@@ -140,38 +140,19 @@ private final GLBufferSizeTracker bufferSizeTracker;
private final GLBufferStateTracker bufferStateTracker;
private final GLStateTracker glStateTracker;
-private boolean bufferObjectExtensionsInitialized = false;
-private boolean haveOESFramebufferObject;
-
-private final void initBufferObjectExtensionChecks() {
- if (bufferObjectExtensionsInitialized)
- return;
- bufferObjectExtensionsInitialized = true;
- haveOESFramebufferObject = isExtensionAvailable("GL_OES_framebuffer_object");
-}
-
-private final boolean checkBufferObject(boolean avail,
- boolean enabled,
+private final boolean checkBufferObject(boolean enabled,
int state,
String kind, boolean throwException) {
- if (!avail) {
- 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);
+ final int buffer = bufferStateTracker.getBoundBufferObject(state, this);
if (enabled) {
- if (buffer == 0) {
+ if (0 == buffer) {
if(throwException) {
throw new GLException(kind + " must be enabled to call this method");
}
return false;
}
} else {
- if (buffer != 0) {
+ if (0 != buffer) {
if(throwException) {
throw new GLException(kind + " must be disabled to call this method");
}
@@ -182,35 +163,27 @@ private final boolean checkBufferObject(boolean avail,
}
private final boolean checkArrayVBODisabled(boolean throwException) {
- initBufferObjectExtensionChecks();
- return checkBufferObject(true,
- false,
- GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object", throwException);
+ return checkBufferObject(false, // enabled
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object", throwException);
}
private final boolean checkArrayVBOEnabled(boolean throwException) {
- initBufferObjectExtensionChecks();
- return checkBufferObject(true,
- true,
- GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object", throwException);
+ return checkBufferObject(true, // enabled
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object", throwException);
}
private final boolean checkElementVBODisabled(boolean throwException) {
- initBufferObjectExtensionChecks();
- return checkBufferObject(true,
- false,
- GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object", throwException);
+ return checkBufferObject(false, // enabled
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object", throwException);
}
private final boolean checkElementVBOEnabled(boolean throwException) {
- initBufferObjectExtensionChecks();
- return checkBufferObject(true,
- true,
- GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object", throwException);
+ return checkBufferObject(true, // enabled
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object", throwException);
}
private final boolean checkUnpackPBODisabled(boolean throwException) {