aboutsummaryrefslogtreecommitdiffstats
path: root/make/gl-impl-CustomJavaCode-gl2.java
diff options
context:
space:
mode:
Diffstat (limited to 'make/gl-impl-CustomJavaCode-gl2.java')
-rw-r--r--make/gl-impl-CustomJavaCode-gl2.java121
1 files changed, 60 insertions, 61 deletions
diff --git a/make/gl-impl-CustomJavaCode-gl2.java b/make/gl-impl-CustomJavaCode-gl2.java
index d9111f6b1..0d2f6676a 100644
--- a/make/gl-impl-CustomJavaCode-gl2.java
+++ b/make/gl-impl-CustomJavaCode-gl2.java
@@ -20,6 +20,10 @@ public GL2Impl(GLContextImpl context) {
this.bufferSizeTracker = context.getBufferSizeTracker();
}
+public final boolean isGL() {
+ return true;
+}
+
public final boolean isGL2() {
return true;
}
@@ -44,6 +48,10 @@ public final boolean isGL2ES2() {
return true;
}
+public final GL getGL() throws GLException {
+ return this;
+}
+
public final GL2 getGL2() throws GLException {
return this;
}
@@ -219,111 +227,129 @@ private void initBufferObjectExtensionChecks() {
haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object");
}
-private void checkBufferObject(boolean extension1,
- boolean extension2,
- boolean extension3,
- boolean enabled,
- int state,
- String kind) {
+private boolean checkBufferObject(boolean extension1,
+ boolean extension2,
+ boolean extension3,
+ boolean enabled,
+ int state,
+ String kind, boolean throwException) {
if (inBeginEndPair) {
throw new GLException("May not call this between glBegin and glEnd");
}
boolean avail = (extension1 || extension2 || extension3);
if (!avail) {
if (!enabled)
- return;
- throw new GLUnsupportedException("Required extensions not available to call this function");
+ return true;
+ if(throwException) {
+ throw new GLUnsupportedException("Required extensions not available to call this function");
+ }
+ return false;
}
int buffer = bufferStateTracker.getBoundBufferObject(state, this);
if (enabled) {
if (buffer == 0) {
- throw new GLException(kind + " must be enabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be enabled to call this method");
+ }
+ return false;
}
} else {
if (buffer != 0) {
- throw new GLException(kind + " must be disabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be disabled to call this method");
+ }
+ return false;
}
}
+ return true;
}
-private void checkArrayVBODisabled() {
+private boolean checkArrayVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
false,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkArrayVBOEnabled() {
+private boolean checkArrayVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
true,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkElementVBODisabled() {
+private boolean checkElementVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
false,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkElementVBOEnabled() {
+private boolean checkElementVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
true,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkUnpackPBODisabled() {
+private boolean checkUnpackPBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
+ return checkBufferObject(haveARBPixelBufferObject,
haveEXTPixelBufferObject,
haveGL21,
false,
GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+ "unpack pixel_buffer_object", throwException);
}
-private void checkUnpackPBOEnabled() {
+private boolean checkUnpackPBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
+ return checkBufferObject(haveARBPixelBufferObject,
haveEXTPixelBufferObject,
haveGL21,
true,
GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+ "unpack pixel_buffer_object", throwException);
}
-private void checkPackPBODisabled() {
+private boolean checkPackPBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
+ return checkBufferObject(haveARBPixelBufferObject,
haveEXTPixelBufferObject,
haveGL21,
false,
GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+ "pack pixel_buffer_object", throwException);
}
-private void checkPackPBOEnabled() {
+private boolean checkPackPBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
+ return checkBufferObject(haveARBPixelBufferObject,
haveEXTPixelBufferObject,
haveGL21,
true,
GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+ "pack pixel_buffer_object", throwException);
+}
+
+public boolean glIsPBOPackEnabled() {
+ return checkPackPBOEnabled(false);
+}
+
+public boolean glIsPBOUnpackEnabled() {
+ return checkUnpackPBOEnabled(false);
}
// Attempt to return the same ByteBuffer object from glMapBuffer if
@@ -395,33 +421,6 @@ native private long dispatch_glMapBuffer(int target, int access, long glProcAddr
// nothing to do
}
- public final String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("GL: ");
- buf.append(getClass().getName());
- buf.append(" (GLSL compiler: ");
- buf.append(glShaderCompilerAvailable());
- Set bfs = glGetShaderBinaryFormats();
- buf.append(", binary formats ");
- buf.append(bfs.size());
- buf.append(":");
- for(Iterator iter=bfs.iterator(); iter.hasNext(); ) {
- buf.append(" ");
- buf.append(((Integer)(iter.next())).intValue());
- }
- buf.append(") (GLContext: ");
- GLContext context = getContext();
- buf.append(context.getClass().getName());
- buf.append(", GLDrawable: ");
- GLDrawable drawable = context.getGLDrawable();
- buf.append(drawable.getClass().getName());
- buf.append(", Factory: ");
- GLDrawableFactory factory = drawable.getFactory();
- buf.append(factory.getClass().getName());
- buf.append(")");
- return buf.toString();
- }
-
public void glVertexPointer(GLArrayData array) {
if(array.getComponentNumber()==0) return;
if(array.isVBO()) {