|
From: <eli...@us...> - 2006-12-20 19:22:34
|
Revision: 2699
http://svn.sourceforge.net/java-game-lib/?rev=2699&view=rev
Author: elias_naur
Date: 2006-12-20 11:22:33 -0800 (Wed, 20 Dec 2006)
Log Message:
-----------
Add GLChecks support methods for GL15 and ARB_buffer_object
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2006-12-20 19:21:35 UTC (rev 2698)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2006-12-20 19:22:33 UTC (rev 2699)
@@ -59,6 +59,18 @@
return StateTracker.getReferencesStack(caps).getReferences();
}
+ static int getBufferObjectSize(ContextCapabilities caps, int buffer_enum) {
+ IntBuffer scratch_buffer = caps.scratch_int_buffer;
+ GL15.glGetBufferParameter(buffer_enum, GL15.GL_BUFFER_SIZE, scratch_buffer);
+ return scratch_buffer.get(0);
+ }
+
+ static int getBufferObjectSizeARB(ContextCapabilities caps, int buffer_enum) {
+ IntBuffer scratch_buffer = caps.scratch_int_buffer;
+ ARBBufferObject.glGetBufferParameterARB(buffer_enum, ARBBufferObject.GL_BUFFER_SIZE_ARB, scratch_buffer);
+ return scratch_buffer.get(0);
+ }
+
private static boolean checkBufferObject(ContextCapabilities caps, int buffer_enum, boolean state) {
IntBuffer scratch_buffer = caps.scratch_int_buffer;
GL11.glGetInteger(buffer_enum, scratch_buffer);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-19 07:42:03
|
Revision: 2769
http://svn.sourceforge.net/java-game-lib/?rev=2769&view=rev
Author: elias_naur
Date: 2007-04-19 00:42:01 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
Cut VBO/PBO sanity checks from two to one glGetInteger call by exploiting GL enum value aliasing (once again inspired by MatthiasM). Additionally, support PBO calls added in OpenGL 2.1.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2007-04-15 19:43:35 UTC (rev 2768)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2007-04-19 07:42:01 UTC (rev 2769)
@@ -80,56 +80,49 @@
/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureArrayVBOdisabled(ContextCapabilities caps) {
- if ((caps.OpenGL15 && !checkBufferObject(caps, GL15.GL_ARRAY_BUFFER_BINDING, false) ||
- (caps.GL_ARB_vertex_buffer_object && !checkBufferObject(caps, ARBVertexBufferObject.GL_ARRAY_BUFFER_BINDING_ARB, false))))
+ if ((caps.OpenGL15 || caps.GL_ARB_vertex_buffer_object) && !checkBufferObject(caps, GL15.GL_ARRAY_BUFFER_BINDING, false))
throw new OpenGLException("Cannot use Buffers when Array Buffer Object is enabled");
}
/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureArrayVBOenabled(ContextCapabilities caps) {
- if ((caps.OpenGL15 && !checkBufferObject(caps, GL15.GL_ARRAY_BUFFER_BINDING, true) ||
- (caps.GL_ARB_vertex_buffer_object && !checkBufferObject(caps, ARBVertexBufferObject.GL_ARRAY_BUFFER_BINDING_ARB, true))))
+ if ((caps.OpenGL15 || caps.GL_ARB_vertex_buffer_object) && !checkBufferObject(caps, GL15.GL_ARRAY_BUFFER_BINDING, true))
throw new OpenGLException("Cannot use offsets when Array Buffer Object is disabled");
}
/** Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureElementVBOdisabled(ContextCapabilities caps) {
- if ((caps.OpenGL15 && !checkBufferObject(caps, GL15.GL_ELEMENT_ARRAY_BUFFER_BINDING, false) ||
- (caps.GL_ARB_vertex_buffer_object && !checkBufferObject(caps, ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, false))))
+ if ((caps.OpenGL15 || caps.GL_ARB_vertex_buffer_object) && !checkBufferObject(caps, GL15.GL_ELEMENT_ARRAY_BUFFER_BINDING, false))
throw new OpenGLException("Cannot use Buffers when Element Array Buffer Object is enabled");
}
/** Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureElementVBOenabled(ContextCapabilities caps) {
- if ((caps.OpenGL15 && !checkBufferObject(caps, GL15.GL_ELEMENT_ARRAY_BUFFER_BINDING, true) ||
- (caps.GL_ARB_vertex_buffer_object && !checkBufferObject(caps, ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, true))))
+ if ((caps.OpenGL15 || caps.GL_ARB_vertex_buffer_object) && !checkBufferObject(caps, GL15.GL_ELEMENT_ARRAY_BUFFER_BINDING, true))
throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled");
}
/** Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensurePackPBOdisabled(ContextCapabilities caps) {
- if ((caps.GL_ARB_pixel_buffer_object && !checkBufferObject(caps, ARBPixelBufferObject.GL_PIXEL_PACK_BUFFER_BINDING_ARB, false) || (caps.GL_EXT_pixel_buffer_object && !checkBufferObject(caps, EXTPixelBufferObject.GL_PIXEL_PACK_BUFFER_BINDING_EXT, false))))
+ if ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_PACK_BUFFER_BINDING, false))
throw new OpenGLException("Cannot use Buffers when Pixel Pack Buffer Object is enabled");
}
/** Helper method to ensure that pixel pack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensurePackPBOenabled(ContextCapabilities caps) {
- if ((caps.GL_ARB_pixel_buffer_object && !checkBufferObject(caps, ARBPixelBufferObject.GL_PIXEL_PACK_BUFFER_BINDING_ARB, true) ||
- (caps.GL_EXT_pixel_buffer_object && !checkBufferObject(caps, EXTPixelBufferObject.GL_PIXEL_PACK_BUFFER_BINDING_EXT, true))))
+ if ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_PACK_BUFFER_BINDING, true))
throw new OpenGLException("Cannot use offsets when Pixel Pack Buffer Object is disabled");
}
/** Helper method to ensure that pixel unpack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureUnpackPBOdisabled(ContextCapabilities caps) {
- if ((caps.GL_ARB_pixel_buffer_object && !checkBufferObject(caps, ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_BINDING_ARB, false) ||
- (caps.GL_EXT_pixel_buffer_object && !checkBufferObject(caps, EXTPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_BINDING_EXT, false))))
+ if ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_UNPACK_BUFFER_BINDING, false))
throw new OpenGLException("Cannot use Buffers when Pixel Unpack Buffer Object is enabled");
}
/** Helper method to ensure that pixel unpack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureUnpackPBOenabled(ContextCapabilities caps) {
- if ((caps.GL_ARB_pixel_buffer_object && !checkBufferObject(caps, ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_BINDING_ARB, true) ||
- (caps.GL_EXT_pixel_buffer_object && !checkBufferObject(caps, EXTPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_BINDING_EXT, true))))
+ if ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_UNPACK_BUFFER_BINDING, true))
throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|