New buffer bounds checking code. Incomplete.

This commit is contained in:
Caspian Rychlik-Prince 2004-02-04 00:42:29 +00:00
parent 10dd32bb95
commit 2cd4fd576c
12 changed files with 86 additions and 34 deletions

View File

@ -52,7 +52,7 @@ import java.util.Map;
* @author cix_foo <cix_foo@users.sourceforge.net>
* @version $Revision$
*/
class BufferChecks {
public class BufferChecks {
/** Static methods only! */
private BufferChecks() {}
@ -103,7 +103,7 @@ class BufferChecks {
* Helper method to ensure that vertex buffer objects are disabled.
* If they are enabled, we'll throw an OpenGLException
*/
static void checkVBOdisabled() {
public static void checkVBOdisabled() {
if (VBOTracker.getVBOArrayStack().getState() != 0) {
throw new OpenGLException("Cannot use Buffers when VBO is enabled");
}
@ -113,7 +113,7 @@ class BufferChecks {
* Helper method to ensure that vertex buffer objects are enabled.
* If they are disabled, we'll throw an OpenGLException
*/
static void checkVBOenabled() {
public static void checkVBOenabled() {
if (VBOTracker.getVBOArrayStack().getState() == 0) {
throw new OpenGLException("Cannot use offsets when VBO is disabled");
}

View File

@ -51,6 +51,7 @@ import java.util.Map;
*/
public abstract class GL11 {
/* AccumOp */
public static final int GL_ACCUM = 0x0100;
public static final int GL_LOAD = 0x0101;

View File

@ -44,6 +44,7 @@ import java.nio.ByteBuffer;
import java.nio.ShortBuffer;
import java.nio.IntBuffer;
import org.lwjgl.opengl.BufferChecks;
import org.lwjgl.opengl.VBOTracker;
import org.lwjgl.opengl.GL11;
@ -61,20 +62,20 @@ public class ARBMatrixPalette {
public static native void glCurrentPaletteMatrixARB(int index);
public static void glMatrixIndexPointerARB(int size, int stride, ByteBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglMatrixIndexPointerARB(size, GL11.GL_UNSIGNED_BYTE, stride, pPointer, pPointer.position());
}
public static void glMatrixIndexPointerARB(int size, int stride, ShortBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglMatrixIndexPointerARB(size, GL11.GL_UNSIGNED_SHORT, stride, pPointer, pPointer.position()<<1);
}
public static void glMatrixIndexPointerARB(int size, int stride, IntBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglMatrixIndexPointerARB(size, GL11.GL_UNSIGNED_INT, stride, pPointer, pPointer.position()<<2);
}
private static native void nglMatrixIndexPointerARB(int size, int type, int stride, Buffer pPointer, int pPointer_offset);
public static void glMatrixIndexPointerARB(int size, int type, int stride, int buffer_offset) {
assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.checkVBOenabled();
nglMatrixIndexPointerARBVBO(size, type, stride, buffer_offset);
}
private static native void nglMatrixIndexPointerARBVBO(int size, int type, int stride, int buffer_offset);

View File

@ -93,6 +93,7 @@ public class ARBOcclusionQuery {
// ---------------------------
public static void glGetQueryObjectiARB(int id, int pname, IntBuffer params) {
// TODO: check buffer size
nglGetQueryObjectivARB(id, pname, params, params.position());
}
@ -101,6 +102,7 @@ public class ARBOcclusionQuery {
// ---------------------------
public static void glGetQueryObjectuiARB(int id, int pname, IntBuffer params) {
// TODO: check buffer size
nglGetQueryObjectuivARB(id, pname, params, params.position());
}

View File

@ -50,6 +50,7 @@ public class ARBPointParameters {
public static native void glPointParameterfARB(int pname, float param);
public static void glPointParameterARB(int pname, FloatBuffer pfParams) {
// TODO: check buffer size
nglPointParameterfvARB(pname, pfParams, pfParams.position());
}
private static native void nglPointParameterfvARB(int pname, FloatBuffer pfParams, int pfParams_offset);

View File

@ -38,6 +38,7 @@
package org.lwjgl.opengl.arb;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.Buffer;
import java.nio.IntBuffer;
@ -167,10 +168,18 @@ class ARBProgram {
float z,
float w);
private static void checkProgramEnv(int index, Buffer buf) {
if (index < 0) {
throw new IllegalArgumentException("<index> must be greater than or equal to 0.");
}
if (buf.remaining() < 4) {
throw new BufferUnderflowException();
}
}
// ---------------------------
public static void glProgramEnvParameterARB(int target, int index, FloatBuffer params) {
assert index >= 0 : "<index> must be greater than or equal to 0.";
assert params.remaining() >= 4 : "<params> must have 4 floats available.";
checkProgramEnv(index, params);
nglProgramEnvParameter4fvARB(target, index, params, params.position());
}
@ -187,8 +196,7 @@ class ARBProgram {
// ---------------------------
public static void glProgramLocalParameterARB(int target, int index, FloatBuffer params) {
assert index >= 0 : "<index> must be greater than or equal to 0.";
assert params.remaining() >= 4 : "<params> must have 4 floats available.";
checkProgramEnv(index, params);
nglProgramLocalParameter4fvARB(target, index, params, params.position());
}
@ -197,8 +205,7 @@ class ARBProgram {
// ---------------------------
public static void glGetProgramEnvParameterARB(int target, int index, FloatBuffer params) {
assert index >= 0 : "<index> must be greater than or equal to 0.";
assert params.remaining() >= 4 : "<params> must have 4 floats available.";
checkProgramEnv(index, params);
nglGetProgramEnvParameterfvARB(target, index, params, params.position());
}
@ -207,8 +214,7 @@ class ARBProgram {
// ---------------------------
public static void glGetProgramLocalParameterARB(int target, int index, FloatBuffer params) {
assert index >= 0 : "<index> must be greater than or equal to 0.";
assert params.remaining() >= 4 : "<params> must have 4 floats available.";
checkProgramEnv(index, params);
nglGetProgramLocalParameterfvARB(target, index, params, params.position());
}
@ -217,6 +223,7 @@ class ARBProgram {
// ---------------------------
public static void glGetProgramARB(int target, int parameterName, IntBuffer params) {
// TODO: Check buffer size
nglGetProgramivARB(target, parameterName, params, params.position());
}
@ -225,6 +232,7 @@ class ARBProgram {
// ---------------------------
public static void glGetProgramStringARB(int target, int parameterName, ByteBuffer paramString) {
// TODO: Check buffer size
nglGetProgramStringARB(target, parameterName, paramString, paramString.position());
}

View File

@ -60,95 +60,122 @@ public class ARBTextureCompression
public static final int GL_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A3;
public static void glCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, ByteBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage1DARB(target, level, internalformat, width, border, imageSize, pData, pData.position());
}
public static void glCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, ShortBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage1DARB(target, level, internalformat, width, border, imageSize, pData, pData.position()<<1);
}
public static void glCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, IntBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage1DARB(target, level, internalformat, width, border, imageSize, pData, pData.position()<<2);
}
public static void glCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, FloatBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage1DARB(target, level, internalformat, width, border, imageSize, pData, pData.position()<<2);
}
private static native void nglCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, Buffer pData, int pData_offset);
public static void glCompressedTexImage2DARB(int target, int level, int internalformat, int width, int height, int border, int imageSize, ByteBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage2DARB(target, level, internalformat, width, height, border, imageSize, pData, pData.position());
}
public static void glCompressedTexImage2DARB(int target, int level, int internalformat, int width, int height, int border, int imageSize, ShortBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage2DARB(target, level, internalformat, width, height, border, imageSize, pData, pData.position()<<1);
}
public static void glCompressedTexImage2DARB(int target, int level, int internalformat, int width, int height, int border, int imageSize, IntBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage2DARB(target, level, internalformat, width, height, border, imageSize, pData, pData.position()<<2);
}
public static void glCompressedTexImage2DARB(int target, int level, int internalformat, int width, int height, int border, int imageSize, FloatBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage2DARB(target, level, internalformat, width, height, border, imageSize, pData, pData.position()<<2);
}
private static native void nglCompressedTexImage2DARB(int target, int level, int internalformat, int width, int height, int border, int imageSize, Buffer pData, int pData_offset);
public static void glCompressedTexImage3DARB(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, ByteBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage3DARB(target, level, internalformat, width, height, depth, border, imageSize, pData, pData.position());
}
public static void glCompressedTexImage3DARB(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, ShortBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage3DARB(target, level, internalformat, width, height, depth, border, imageSize, pData, pData.position()<<1);
}
public static void glCompressedTexImage3DARB(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, IntBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage3DARB(target, level, internalformat, width, height, depth, border, imageSize, pData, pData.position()<<2);
}
public static void glCompressedTexImage3DARB(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, FloatBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage3DARB(target, level, internalformat, width, height, depth, border, imageSize, pData, pData.position()<<2);
}
private static native void nglCompressedTexImage3DARB(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, Buffer pData, int pData_offset);
public static void glCompressedTexSubImage1DARB(int target, int level, int xoffset, int width, int border, int imageSize, ByteBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage1DARB(target, level, xoffset, width, border, imageSize, pData, pData.position());
}
public static void glCompressedTexSubImage1DARB(int target, int level, int xoffset, int width, int border, int imageSize, ShortBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage1DARB(target, level, xoffset, width, border, imageSize, pData, pData.position()<<1);
}
public static void glCompressedTexSubImage1DARB(int target, int level, int xoffset, int width, int border, int imageSize, IntBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage1DARB(target, level, xoffset, width, border, imageSize, pData, pData.position()<<2);
}
public static void glCompressedTexSubImage1DARB(int target, int level, int xoffset, int width, int border, int imageSize, FloatBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage1DARB(target, level, xoffset, width, border, imageSize, pData, pData.position()<<2);
}
private static native void nglCompressedTexSubImage1DARB(int target, int level, int xoffset, int width, int border, int imageSize, Buffer pData, int pData_offset);
public static void glCompressedTexSubImage2DARB(int target, int level, int xoffset, int yoffset, int width, int height, int border, int imageSize, ByteBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage2DARB(target, level, xoffset, yoffset, width, height, border, imageSize, pData, pData.position());
}
public static void glCompressedTexSubImage2DARB(int target, int level, int xoffset, int yoffset, int width, int height, int border, int imageSize, ShortBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage2DARB(target, level, xoffset, yoffset, width, height, border, imageSize, pData, pData.position()<<1);
}
public static void glCompressedTexSubImage2DARB(int target, int level, int xoffset, int yoffset, int width, int height, int border, int imageSize, IntBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage2DARB(target, level, xoffset, yoffset, width, height, border, imageSize, pData, pData.position()<<2);
}
public static void glCompressedTexSubImage2DARB(int target, int level, int xoffset, int yoffset, int width, int height, int border, int imageSize, FloatBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage2DARB(target, level, xoffset, yoffset, width, height, border, imageSize, pData, pData.position()<<2);
}
private static native void nglCompressedTexSubImage2DARB(int target, int level, int xoffset, int yoffset, int width, int height, int border, int imageSize, Buffer pData, int pData_offset);
public static void glCompressedTexSubImage3DARB(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int border, int imageSize, ByteBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage3DARB(target, level, xoffset, yoffset, zoffset, width, height, depth, border, imageSize, pData, pData.position());
}
public static void glCompressedTexSubImage3DARB(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int border, int imageSize, ShortBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage3DARB(target, level, xoffset, yoffset, zoffset, width, height, depth, border, imageSize, pData, pData.position()<<1);
}
public static void glCompressedTexSubImage3DARB(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int border, int imageSize, IntBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage3DARB(target, level, xoffset, yoffset, zoffset, width, height, depth, border, imageSize, pData, pData.position()<<2);
}
public static void glCompressedTexSubImage3DARB(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int border, int imageSize, FloatBuffer pData) {
// TODO: Check buffer size
nglCompressedTexSubImage3DARB(target, level, xoffset, yoffset, zoffset, width, height, depth, border, imageSize, pData, pData.position()<<2);
}
private static native void nglCompressedTexSubImage3DARB(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int border, int imageSize, Buffer pData, int pData_offset);
public static void glGetCompressedTexImageARB(int target, int lod, ByteBuffer pImg) {
// TODO: Check buffer size
nglGetCompressedTexImageARB(target, lod, pImg, pImg.position());
}
public static void glGetCompressedTexImageARB(int target, int lod, ShortBuffer pImg) {
// TODO: Check buffer size
nglGetCompressedTexImageARB(target, lod, pImg, pImg.position()<<1);
}
public static void glGetCompressedTexImageARB(int target, int lod, IntBuffer pImg) {
// TODO: Check buffer size
nglGetCompressedTexImageARB(target, lod, pImg, pImg.position()<<2);
}
private static native void nglGetCompressedTexImageARB(int target, int lod, Buffer pImg, int pImg_offset);

View File

@ -39,6 +39,7 @@
*/
package org.lwjgl.opengl.arb;
import java.nio.BufferUnderflowException;
import java.nio.FloatBuffer;
public class ARBTransposeMatrix {
@ -48,11 +49,17 @@ public class ARBTransposeMatrix {
public static final int GL_TRANSPOSE_COLOR_MATRIX_ARB = 0x84E6;
public static void glLoadTransposeMatrixARB(FloatBuffer pfMtx) {
if (pfMtx.remaining() < 16) {
throw new BufferUnderflowException();
}
nglLoadTransposeMatrixfARB(pfMtx, pfMtx.position());
}
private static native void nglLoadTransposeMatrixfARB(FloatBuffer pfMtx, int pfMtx_offset);
public static void glMultTransposeMatrixfARB(FloatBuffer pfMtx) {
if (pfMtx.remaining() < 16) {
throw new BufferUnderflowException();
}
nglMultTransposeMatrixfARB(pfMtx, pfMtx.position());
}
private static native void nglMultTransposeMatrixfARB(FloatBuffer pfMtx, int pfMtx_offset);

View File

@ -45,6 +45,7 @@ import java.nio.ShortBuffer;
import java.nio.IntBuffer;
import java.nio.FloatBuffer;
import org.lwjgl.opengl.BufferChecks;
import org.lwjgl.opengl.VBOTracker;
import org.lwjgl.opengl.GL11;
@ -128,26 +129,26 @@ public class ARBVertexBlend {
private static native void nglWeightusvARB(int size, ShortBuffer psWeights, int psWeights_offset);
public static void glWeightPointerARB(int size, boolean unsigned, int stride, ByteBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglWeightPointerARB(size, unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, stride, pPointer, pPointer.position());
}
public static void glWeightPointerARB(int size, boolean unsigned, int stride, ShortBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglWeightPointerARB(size, unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, stride, pPointer, pPointer.position()<<1);
}
public static void glWeightPointerARB(int size, int stride, FloatBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglWeightPointerARB(size, GL11.GL_FLOAT, stride, pPointer, pPointer.position()<<2);
}
public static void glWeightPointerARB(int size, boolean unsigned, int stride, IntBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglWeightPointerARB(size, unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, stride, pPointer, pPointer.position()<<2);
}
private static native void nglWeightPointerARB(int size, int type, int stride, Buffer pPointer, int pPointer_offset);
public static void glWeightPointerARB(int size, int type, int stride, int buffer_offset) {
assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.checkVBOenabled();
nglWeightPointerARBVBO(size, type, stride, buffer_offset);
}
private static native void nglWeightPointerARBVBO(int size, int type, int stride, int buffer_offset);
public static native void glVertexBlendARB(int count);
public static native void glVertexBlendARB(int count);
}

View File

@ -170,6 +170,7 @@ public class ARBVertexBufferObject {
public static native ByteBuffer glMapBufferARB(int target, int access, int size, ByteBuffer oldBuffer);
public static native boolean glUnmapBufferARB(int target);
public static void glGetBufferParameterARB(int target, int pname, IntBuffer params) {
// TODO:check buffer size
nglGetBufferParameterivARB(target, pname, params, params.position());
}
private static native void nglGetBufferParameterivARB(int target, int pname, IntBuffer params, int params_offset);

View File

@ -38,6 +38,7 @@
package org.lwjgl.opengl.arb;
import org.lwjgl.opengl.BufferChecks;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.VBOTracker;
import java.nio.Buffer;
@ -115,22 +116,22 @@ public class ARBVertexProgram extends ARBProgram {
public static native void glVertexAttrib4NubARB(int index, byte x, byte y, byte z, byte w);
public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, ByteBuffer buffer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglVertexAttribPointerARB(index, size, unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, normalized, stride, buffer, buffer.position());
}
public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, ShortBuffer buffer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglVertexAttribPointerARB(index, size, unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, normalized, stride, buffer, buffer.position() << 1);
}
public static void glVertexAttribPointerARB(int index, int size, boolean normalized, int stride, FloatBuffer buffer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglVertexAttribPointerARB(index, size, GL11.GL_FLOAT, normalized, stride, buffer, buffer.position() << 2);
}
public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, IntBuffer buffer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.checkVBOdisabled();
nglVertexAttribPointerARB(index, size, unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, normalized, stride, buffer, buffer.position() << 2);
}
@ -138,7 +139,7 @@ public class ARBVertexProgram extends ARBProgram {
// ---------------------------
public static void glVertexAttribPointerARB(int index, int size, int type, boolean normalized, int stride, int bufferOffset) {
assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.checkVBOenabled();
nglVertexAttribPointerARBVBO(index, size, type, normalized, stride, bufferOffset);
}
@ -151,7 +152,7 @@ public class ARBVertexProgram extends ARBProgram {
// ---------------------------
public static void glGetVertexAttribARB(int index, int pname, FloatBuffer params) {
assert params.remaining() > 0 : "<params> must have at least one element available.";
// TODO: check buffer size
nglGetVertexAttribfvARB(index, pname, params, params.position());
}
@ -160,7 +161,7 @@ public class ARBVertexProgram extends ARBProgram {
// ---------------------------
public static void glGetVertexAttribARB(int index, int pname, IntBuffer params) {
assert params.remaining() > 0 : "<params> must have at least one element available.";
// TODO: check buffer size
nglGetVertexAttribivARB(index, pname, params, params.position());
}

View File

@ -65,7 +65,9 @@ public class ARBVertexShader {
// ---------------------------
public static void glBindAttribLocationARB(int programObj, int index, ByteBuffer name) {
assert name.get(name.limit()) == 0 : "<name> must be a null-terminated string.";
if (name.get(name.limit()) != 0) {
throw new IllegalArgumentException("<name> must be a null-terminated string.");
}
nglBindAttribLocationARB(programObj, index, name, name.position());
}
@ -76,14 +78,12 @@ public class ARBVertexShader {
// ---------------------------
public static void glGetActiveAttribARB(int programObj, int index, IntBuffer length,
IntBuffer size, IntBuffer type, ByteBuffer name) {
assert size.remaining() > 0 : "<size> must have at least one element available.";
assert type.remaining() > 0 : "<type> must have at least one element available.";
// TODO: check buffer size
if ( length == null )
nglGetActiveAttribARB(programObj, index, name.remaining(), null, -1, size, size.position(),
type, type.position(), name, name.position());
else {
assert length.remaining() > 0 : "<length> must have at least one element available.";
nglGetActiveAttribARB(programObj, index, name.remaining(), length, length.position(), size,
size.position(), type, type.position(), name, name.position());
}
@ -97,7 +97,9 @@ public class ARBVertexShader {
// ---------------------------
public static int glGetAttribLocationARB(int programObj, ByteBuffer name) {
assert name.get(name.limit()) == 0 : "<name> must be null-terminated.";
if (name.get(name.limit()) != 0) {
throw new IllegalArgumentException("<name> must be a null-terminated string.");
}
return nglGetAttribLocationARB(programObj, name, name.position());
}