Buffer checking code

This commit is contained in:
Caspian Rychlik-Prince 2004-02-15 19:41:51 +00:00
parent fd56dd232a
commit 061e1a76d1
51 changed files with 499 additions and 655 deletions

View File

@ -81,11 +81,6 @@ public class ARBFragmentProgram extends ARBProgram {
public static final int GL_MAX_TEXTURE_COORDS_ARB = 0x8871;
public static final int GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872;
static {
BufferChecks.putGetMap(GL_FRAGMENT_PROGRAM_ARB, 1);
BufferChecks.putGetMap(GL_MAX_TEXTURE_COORDS_ARB, 1);
BufferChecks.putGetMap(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, 1);
}
}

View File

@ -50,9 +50,6 @@ public class ARBFragmentShader {
* GetDoublev:
*/
public static final int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 0x8B49;
static {
BufferChecks.putGetMap(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, 1);
}
}

View File

@ -57,32 +57,22 @@ public class ARBMatrixPalette {
public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = 0x8848;
public static final int GL_MATRIX_INDEX_ARRAY_POINTER_ARB = 0x8849;
static {
BufferChecks.putGetMap(GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB, 1);
BufferChecks.putGetMap(GL_MAX_PALETTE_MATRICES_ARB, 1);
BufferChecks.putGetMap(GL_CURRENT_PALETTE_MATRIX_ARB, 1);
BufferChecks.putGetMap(GL_MATRIX_INDEX_ARRAY_SIZE_ARB, 1);
BufferChecks.putGetMap(GL_MATRIX_INDEX_ARRAY_TYPE_ARB, 1);
BufferChecks.putGetMap(GL_MATRIX_INDEX_ARRAY_STRIDE_ARB, 1);
BufferChecks.putGetMap(GL_MATRIX_INDEX_ARRAY_POINTER_ARB, 1); // TODO: figure out what to do with pointers
}
public static native void glCurrentPaletteMatrixARB(int index);
public static void glMatrixIndexPointerARB(int size, int stride, ByteBuffer pPointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglMatrixIndexPointerARB(size, GL11.GL_UNSIGNED_BYTE, stride, pPointer, pPointer.position());
}
public static void glMatrixIndexPointerARB(int size, int stride, ShortBuffer pPointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglMatrixIndexPointerARB(size, GL11.GL_UNSIGNED_SHORT, stride, pPointer, pPointer.position()<<1);
}
public static void glMatrixIndexPointerARB(int size, int stride, IntBuffer pPointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
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) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglMatrixIndexPointerARBVBO(size, type, stride, buffer_offset);
}
private static native void nglMatrixIndexPointerARBVBO(int size, int type, int stride, int buffer_offset);

View File

@ -50,16 +50,6 @@ public class ARBMultisample {
public static final int GL_SAMPLE_COVERAGE_INVERT_ARB = 0x80AB;
public static final int GL_MULTISAMPLE_BIT_ARB = 0x20000000;
static {
BufferChecks.putGetMap(GL_MULTISAMPLE_ARB, 1);
BufferChecks.putGetMap(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB, 1);
BufferChecks.putGetMap(GL_SAMPLE_ALPHA_TO_ONE_ARB, 1);
BufferChecks.putGetMap(GL_SAMPLE_COVERAGE_ARB, 1);
BufferChecks.putGetMap(GL_SAMPLE_BUFFERS_ARB, 1);
BufferChecks.putGetMap(GL_SAMPLES_ARB, 1);
BufferChecks.putGetMap(GL_SAMPLE_COVERAGE_VALUE_ARB, 1);
BufferChecks.putGetMap(GL_SAMPLE_COVERAGE_INVERT_ARB, 1);
}
public static native void glSampleCoverageARB(float value, boolean invert);
}

View File

@ -76,12 +76,6 @@ public class ARBMultitexture {
public static final int GL_CLIENT_ACTIVE_TEXTURE_ARB = 0x84E1;
public static final int GL_MAX_TEXTURE_UNITS_ARB = 0x84E2;
static {
BufferChecks.putGetMap(GL_ACTIVE_TEXTURE_ARB, 1);
BufferChecks.putGetMap(GL_CLIENT_ACTIVE_TEXTURE_ARB, 1);
BufferChecks.putGetMap(GL_MAX_TEXTURE_UNITS_ARB, 1);
}
public static native void glClientActiveTextureARB(int texture);
public static native void glActiveTextureARB(int texture);

View File

@ -85,6 +85,7 @@ public class ARBOcclusionQuery {
// ---------------------------
public static void glGetQueryARB(int target, int pname, IntBuffer params) {
BufferChecks.checkBuffer(params);
nglGetQueryivARB(target, pname, params, params.position());
}
@ -93,7 +94,7 @@ public class ARBOcclusionQuery {
// ---------------------------
public static void glGetQueryObjectiARB(int id, int pname, IntBuffer params) {
// TODO: check buffer size
BufferChecks.checkBuffer(params);
nglGetQueryObjectivARB(id, pname, params, params.position());
}
@ -102,7 +103,7 @@ public class ARBOcclusionQuery {
// ---------------------------
public static void glGetQueryObjectuiARB(int id, int pname, IntBuffer params) {
// TODO: check buffer size
BufferChecks.checkBuffer(params);
nglGetQueryObjectuivARB(id, pname, params, params.position());
}

View File

@ -47,17 +47,11 @@ public class ARBPointParameters {
public static final int GL_POINT_FADE_THRESHOLD_SIZE_ARB = 0x8128;
public static final int GL_POINT_DISTANCE_ATTENUATION_ARB = 0x8129;
static {
BufferChecks.putGetMap(GL_POINT_SIZE_MIN_ARB, 1);
BufferChecks.putGetMap(GL_POINT_SIZE_MAX_ARB, 1);
BufferChecks.putGetMap(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1);
BufferChecks.putGetMap(GL_POINT_DISTANCE_ATTENUATION_ARB, 3);
}
public static native void glPointParameterfARB(int pname, float param);
public static void glPointParameterARB(int pname, FloatBuffer pfParams) {
// TODO: check buffer size
BufferChecks.checkBuffer(pfParams);
nglPointParameterfvARB(pname, pfParams, pfParams.position());
}
private static native void nglPointParameterfvARB(int pname, FloatBuffer pfParams, int pfParams_offset);

View File

@ -24,8 +24,5 @@ public class ARBPointSprite {
*/
public static final int GL_COORD_REPLACE_ARB = 0x8862;
static {
BufferChecks.putGetMap(GL_POINT_SPRITE_ARB, 1);
}
}

View File

@ -39,6 +39,7 @@
package org.lwjgl.opengl;
import java.nio.Buffer;
import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
@ -133,15 +134,7 @@ class ARBProgram {
public static final int GL_MATRIX29_ARB = 0x88DD;
public static final int GL_MATRIX30_ARB = 0x88DE;
public static final int GL_MATRIX31_ARB = 0x88DF;
static {
BufferChecks.putGetMap(GL_PROGRAM_ERROR_POSITION_ARB, 1);
BufferChecks.putGetMap(GL_CURRENT_MATRIX_ARB, 1);
BufferChecks.putGetMap(GL_TRANSPOSE_CURRENT_MATRIX_ARB, 1);
BufferChecks.putGetMap(GL_CURRENT_MATRIX_STACK_DEPTH_ARB, 1);
BufferChecks.putGetMap(GL_MAX_PROGRAM_MATRICES_ARB, 1);
BufferChecks.putGetMap(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
}
// ---------------------------
public static void glProgramStringARB(int target, int format, ByteBuffer string) {
@ -232,7 +225,7 @@ class ARBProgram {
// ---------------------------
public static void glGetProgramARB(int target, int parameterName, IntBuffer params) {
// TODO: Check buffer size
BufferChecks.checkBuffer(params);
nglGetProgramivARB(target, parameterName, params, params.position());
}
@ -241,7 +234,11 @@ class ARBProgram {
// ---------------------------
public static void glGetProgramStringARB(int target, int parameterName, ByteBuffer paramString) {
// TODO: Check buffer size
// TODO: We have no idea just how big programs can be really so let's guess at 16kb and hope that's
// good enough. So we ought to find out how big a program can be.
if (paramString.remaining() < 16384) {
throw new BufferOverflowException();
}
nglGetProgramStringARB(target, parameterName, paramString, paramString.position());
}

View File

@ -38,6 +38,7 @@
package org.lwjgl.opengl;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
@ -328,7 +329,9 @@ public class ARBShaderObjects {
if ( length == null )
nglGetInfoLogARB(obj, infoLog.remaining(), null, -1, infoLog, infoLog.position());
else {
assert length.remaining() > 0 : "<length> must have at least one element available.";
if (length.remaining() == 0) {
throw new BufferOverflowException();
}
nglGetInfoLogARB(obj, infoLog.remaining(), length, length.position(), infoLog, infoLog.position());
}
}
@ -348,7 +351,9 @@ public class ARBShaderObjects {
if ( count == null )
nglGetAttachedObjectsARB(containerObj, obj.remaining(), null, -1, obj, obj.position());
else {
assert count.remaining() > 0 : "<count> must have at least one element available.";
if (count.remaining() == 0) {
throw new BufferOverflowException();
}
nglGetAttachedObjectsARB(containerObj, obj.remaining(), count, count.position(), obj, obj.position());
}
}
@ -363,7 +368,9 @@ public class ARBShaderObjects {
// ---------------------------
public static int glGetUniformLocationARB(int programObj, ByteBuffer name) {
assert name.get(name.limit()) == 0 : "<name> must be null-terminated.";
if (name.get(name.limit() - 1) != 0) {
throw new RuntimeException("<name> must be null-terminated.");
}
return nglGetUniformLocationARB(programObj, name, name.position());
}
@ -379,8 +386,12 @@ public class ARBShaderObjects {
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.";
if (size.remaining() == 0) {
throw new BufferOverflowException();
}
if (type.remaining() == 0) {
throw new BufferOverflowException();
}
if ( length == null )
nglGetActiveUniformARB(programObj,
@ -395,7 +406,9 @@ public class ARBShaderObjects {
name,
name.position());
else {
assert length.remaining() > 0 : "<length> must have at least one element available.";
if (length.remaining() == 0) {
throw new BufferOverflowException();
}
nglGetActiveUniformARB(programObj,
index,
name.remaining(),

View File

@ -59,129 +59,96 @@ public class ARBTextureCompression
public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A2;
public static final int GL_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A3;
static {
BufferChecks.putGetMap(GL_TEXTURE_COMPRESSION_HINT_ARB, 1);
BufferChecks.putGetMap(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, 1);
BufferChecks.putGetMap(GL_COMPRESSED_TEXTURE_FORMATS_ARB, 1);
}
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

@ -54,9 +54,4 @@ public class ARBTextureCubeMap {
public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = 0x851C;
static {
BufferChecks.putGetMap(GL_TEXTURE_BINDING_CUBE_MAP_ARB, 1);
BufferChecks.putGetMap(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, 1);
}
}

View File

@ -39,7 +39,6 @@
*/
package org.lwjgl.opengl;
import java.nio.BufferUnderflowException;
import java.nio.FloatBuffer;
public class ARBTransposeMatrix {
@ -47,26 +46,15 @@ public class ARBTransposeMatrix {
public static final int GL_TRANSPOSE_PROJECTION_MATRIX_ARB = 0x84E4;
public static final int GL_TRANSPOSE_TEXTURE_MATRIX_ARB = 0x84E5;
public static final int GL_TRANSPOSE_COLOR_MATRIX_ARB = 0x84E6;
static {
BufferChecks.putGetMap(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB, 16);
BufferChecks.putGetMap(GL_TRANSPOSE_PROJECTION_MATRIX_ARB, 16);
BufferChecks.putGetMap(GL_TRANSPOSE_TEXTURE_MATRIX_ARB, 16);
BufferChecks.putGetMap(GL_TRANSPOSE_COLOR_MATRIX_ARB, 16);
}
public static void glLoadTransposeMatrixARB(FloatBuffer pfMtx) {
if (pfMtx.remaining() < 16) {
throw new BufferUnderflowException();
}
BufferChecks.checkBuffer(pfMtx);
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();
}
BufferChecks.checkBuffer(pfMtx);
nglMultTransposeMatrixfARB(pfMtx, pfMtx.position());
}
private static native void nglMultTransposeMatrixfARB(FloatBuffer pfMtx, int pfMtx_offset);

View File

@ -89,7 +89,7 @@ public class ARBVertexBlend {
public static final int GL_MODELVIEW29_ARB = 0x873D;
public static final int GL_MODELVIEW30_ARB = 0x873E;
public static final int GL_MODELVIEW31_ARB = 0x873F;
public static void glWeightARB(ByteBuffer pWeights) {
nglWeightbvARB(pWeights.remaining(), pWeights, pWeights.position());
}
@ -126,24 +126,24 @@ 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) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
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) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
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) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglWeightPointerARB(size, GL11.GL_FLOAT, stride, pPointer, pPointer.position()<<2);
}
public static void glWeightPointerARB(int size, boolean unsigned, int stride, IntBuffer pPointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
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) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglWeightPointerARBVBO(size, type, stride, buffer_offset);
}
private static native void nglWeightPointerARBVBO(int size, int type, int stride, int buffer_offset);

View File

@ -80,7 +80,7 @@ public class ARBVertexBufferObject {
public static final int GL_BUFFER_ACCESS_ARB = 0x88BB;
public static final int GL_BUFFER_MAPPED_ARB = 0x88BC;
public static final int GL_BUFFER_MAP_POINTER_ARB = 0x88BD;
public static void glBindBufferARB(int target, int buffer) {
switch (target) {
case GL_ELEMENT_ARRAY_BUFFER_ARB:
@ -169,7 +169,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
BufferChecks.checkBuffer(params);
nglGetBufferParameterivARB(target, pname, params, params.position());
}
private static native void nglGetBufferParameterivARB(int target, int pname, IntBuffer params, int params_offset);

View File

@ -87,7 +87,7 @@ public class ARBVertexProgram extends ARBProgram {
public static final int GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B1;
public static final int GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B2;
public static final int GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B3;
/*
* Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
* GetFloatv, and GetDoublev:
@ -113,22 +113,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) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
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) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
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) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
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) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglVertexAttribPointerARB(index, size, unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, normalized, stride, buffer, buffer.position() << 2);
}
@ -136,7 +136,7 @@ public class ARBVertexProgram extends ARBProgram {
// ---------------------------
public static void glVertexAttribPointerARB(int index, int size, int type, boolean normalized, int stride, int bufferOffset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglVertexAttribPointerARBVBO(index, size, type, normalized, stride, bufferOffset);
}
@ -149,7 +149,7 @@ public class ARBVertexProgram extends ARBProgram {
// ---------------------------
public static void glGetVertexAttribARB(int index, int pname, FloatBuffer params) {
// TODO: check buffer size
BufferChecks.checkBuffer(params);
nglGetVertexAttribfvARB(index, pname, params, params.position());
}
@ -158,7 +158,7 @@ public class ARBVertexProgram extends ARBProgram {
// ---------------------------
public static void glGetVertexAttribARB(int index, int pname, IntBuffer params) {
// TODO: check buffer size
BufferChecks.checkBuffer(params);
nglGetVertexAttribivARB(index, pname, params, params.position());
}

View File

@ -63,10 +63,11 @@ public class ARBVertexShader {
public static final int GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89;
public static final int GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A;
// ---------------------------
public static void glBindAttribLocationARB(int programObj, int index, ByteBuffer name) {
if (name.get(name.limit()) != 0) {
throw new IllegalArgumentException("<name> must be a null-terminated string.");
if (name.get(name.limit() - 1) != 0) {
throw new RuntimeException("<name> must be a null-terminated string.");
}
nglBindAttribLocationARB(programObj, index, name, name.position());
}
@ -78,7 +79,7 @@ public class ARBVertexShader {
// ---------------------------
public static void glGetActiveAttribARB(int programObj, int index, IntBuffer length,
IntBuffer size, IntBuffer type, ByteBuffer name) {
// TODO: check buffer size
BufferChecks.checkBuffer(name);
if ( length == null )
nglGetActiveAttribARB(programObj, index, name.remaining(), null, -1, size, size.position(),
@ -97,8 +98,8 @@ public class ARBVertexShader {
// ---------------------------
public static int glGetAttribLocationARB(int programObj, ByteBuffer name) {
if (name.get(name.limit()) != 0) {
throw new IllegalArgumentException("<name> must be a null-terminated string.");
if (name.get(name.limit() - 1) != 0) {
throw new RuntimeException("<name> must be a null-terminated string.");
}
return nglGetAttribLocationARB(programObj, name, name.position());
}

View File

@ -64,9 +64,12 @@ public class ATIDrawBuffers {
public static final int GL_DRAW_BUFFER14_ATI = 0x8833;
public static final int GL_DRAW_BUFFER15_ATI = 0x8834;
// ---------------------------
public static void glDrawBuffersATI(IntBuffer buffers) {
assert buffers.remaining() > 0 : "<buffers> must have at least 1 integer available.";
if (buffers.remaining() == 0) {
throw new RuntimeException("<buffers> must have at least 1 integer available.");
}
nglDrawBuffersATI(buffers.remaining(), buffers, buffers.position());
}

View File

@ -51,21 +51,21 @@ public class ATIElementArray {
public static final int GL_ELEMENT_ARRAY_POINTER_ATI = 0x876A;
public static void glElementPointerATI(ByteBuffer pPointer) {
assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglElementPointerATI(GL11.GL_UNSIGNED_BYTE, pPointer, pPointer.position());
}
public static void glElementPointerATI(ShortBuffer pPointer) {
assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglElementPointerATI(GL11.GL_UNSIGNED_SHORT, pPointer, pPointer.position()<<1);
}
public static void glElementPointerATI(IntBuffer pPointer) {
assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglElementPointerATI(GL11.GL_UNSIGNED_INT, pPointer, pPointer.position()<<2);
}
private static native void nglElementPointerATI(int type, Buffer pPointer, int pPointer_offset);
public static void glElementPointerATI(int type, int buffer_offset) {
assert VBOTracker.getVBOElementStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.ensureVBOenabled();
nglElementPointerATIVBO(type, buffer_offset);
}
private static native void nglElementPointerATIVBO(int type, int buffer_offset);

View File

@ -53,21 +53,25 @@ public class ATIEnvmapBumpmap {
public static final int GL_BUMP_TARGET_ATI = 0x877C;
public static void glTexBumpParameterATI(int pname, FloatBuffer pfParam) {
BufferChecks.checkBuffer(pfParam);
nglTexBumpParameterfvATI(pname, pfParam, pfParam.position());
}
private static native void nglTexBumpParameterfvATI(int pname, FloatBuffer pfParam, int pfParam_offset);
public static void glTexBumpParameterATI(int pname, IntBuffer piParam) {
BufferChecks.checkBuffer(piParam);
nglTexBumpParameterivATI(pname, piParam, piParam.position());
}
private static native void nglTexBumpParameterivATI(int pname, IntBuffer piParam, int piParam_offset);
public static void glGetTexBumpParameterATI(int pname, FloatBuffer pfParam) {
BufferChecks.checkBuffer(pfParam);
nglGetTexBumpParameterfvATI(pname, pfParam, pfParam.position());
}
private static native void nglGetTexBumpParameterfvATI(int pname, FloatBuffer pfParam, int pfParam_offset);
public static void glGetTexBumpParameterATI(int pname, IntBuffer piParam) {
BufferChecks.checkBuffer(piParam);
nglGetTexBumpParameterivATI(pname, piParam, piParam.position());
}
private static native void nglGetTexBumpParameterivATI(int pname, IntBuffer piParam, int piParam_offset);

View File

@ -151,6 +151,7 @@ public class ATIFragmentShader {
public static final int GL_NEGATE_BIT_ATI = 0x00000004;
public static final int GL_BIAS_BIT_ATI = 0x00000008;
public static native int glGenFragmentShadersATI(int range);
public static native void glBindFragmentShaderATI(int id);
@ -235,6 +236,7 @@ public class ATIFragmentShader {
int arg3Mod);
public static void glSetFragmentShaderConstantATI(int dst, FloatBuffer pfValue) {
BufferChecks.checkBuffer(pfValue); // TODO:is this correct?
nglSetFragmentShaderConstantATI(dst, pfValue, pfValue.position());
}
private static native void nglSetFragmentShaderConstantATI(int dst, FloatBuffer pfValue, int pfValue_offset);

View File

@ -49,7 +49,7 @@ public class ATIPnTriangles {
public static final int GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI = 0x87F6;
public static final int GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = 0x87F7;
public static final int GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = 0x87F8;
public static native void glPNTrianglesfATI(int pname, float param);
public static native void glPNTrianglesiATI(int pname, int param);

View File

@ -38,7 +38,7 @@
package org.lwjgl.opengl;
public interface ATITextureFloat {
public class ATITextureFloat {
/*
* Accepted by the <internalFormat> parameter of TexImage1D,

View File

@ -54,7 +54,7 @@ public class ATIVertexArrayObject {
public static final int GL_OBJECT_BUFFER_USAGE_ATI = 0x8765;
public static final int GL_ARRAY_OBJECT_BUFFER_ATI = 0x8766;
public static final int GL_ARRAY_OBJECT_OFFSET_ATI = 0x8767;
public static int glNewObjectBufferATI(int size, ByteBuffer pPointer, int usage) {
return nglNewObjectBufferATI(size, pPointer, pPointer != null ? pPointer.position() : 0, usage);
}
@ -103,11 +103,13 @@ public class ATIVertexArrayObject {
int offset);
public static void glGetArrayObjectATI(int array, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglGetArrayObjectfvATI(array, pname, pfParams, pfParams.position());
}
private static native void nglGetArrayObjectfvATI(int array, int pname, FloatBuffer pfParams, int pfParams_offset);
public static void glGetArrayObjectATI(int array, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetArrayObjectivATI(array, pname, piParams, piParams.position());
}
private static native void nglGetArrayObjectivATI(int array, int pname, IntBuffer piParams, int piParams_offset);
@ -120,11 +122,13 @@ public class ATIVertexArrayObject {
int offset);
public static void glGetVariantArrayObjectATI(int id, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglGetVariantArrayObjectfvATI(id, pname, pfParams, pfParams.position());
}
private static native void nglGetVariantArrayObjectfvATI(int id, int pname, FloatBuffer pfParams, int pfParams_offset_offset);
public static void glGetVariantArrayObjectATI(int id, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetVariantArrayObjectivATI(id, pname, piParams, piParams.position());
}
private static native void nglGetVariantArrayObjectivATI(int id, int pname, IntBuffer piParams, int piParams_offset);

View File

@ -49,6 +49,7 @@ public class ATIVertexAttribArrayObject {
// ---------------------------
public static void glGetVertexAttribArrayObjectATI(int index, int pname, FloatBuffer params) {
BufferChecks.checkBuffer(params);
nglGetVertexAttribArrayObjectfvATI(index, pname, params, params.position());
}
@ -59,6 +60,7 @@ public class ATIVertexAttribArrayObject {
// ---------------------------
public static void glGetVertexAttribArrayObjectATI(int index, int pname, IntBuffer params) {
BufferChecks.checkBuffer(params);
nglGetVertexAttribArrayObjectivATI(index, pname, params, params.position());
}

View File

@ -1,51 +1,43 @@
/*
* Copyright (c) 2002 Lightweight Java Game Library Project
* All rights reserved.
/*
* Copyright (c) 2002 Lightweight Java Game Library Project All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of 'Light Weight Java Game Library' nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'Light Weight Java Game Library' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.lwjgl.opengl;
import java.nio.Buffer;
import java.nio.BufferOverflowException;
import java.util.HashMap;
import java.util.Map;
/**
* $Id$
* A class to check buffer boundaries in GL methods. Many GL methods read data from the GL
* into a native Buffer at its current position. If there is unsufficient space in the buffer
* when the call is made then a buffer overflow would otherwise occur and cause unexpected
* behaviour, a crash, or worse, a security risk. Therefore in those methods where GL reads
* data back into a buffer, we will call a bounds check method from this class to ensure that
* there is sufficient space in the buffer.
*
* $Id$ A class to
* check buffer boundaries in GL methods. Many GL methods read data from the GL
* into a native Buffer at its current position. If there is unsufficient space
* in the buffer when the call is made then a buffer overflow would otherwise
* occur and cause unexpected behaviour, a crash, or worse, a security risk.
* Therefore in those methods where GL reads data back into a buffer, we will
* call a bounds check method from this class to ensure that there is
* sufficient space in the buffer.
*
* Thrown by the debug build library of the LWJGL if any OpenGL operation
* causes an error.
*
@ -53,71 +45,122 @@ import java.util.Map;
* @version $Revision$
*/
class BufferChecks {
/** Static methods only! */
private BufferChecks() {}
private static Map pixelMapMap = new HashMap();
private static Map getMap = new HashMap();
private static final Util.IntValue scratchInt = new Util.IntValue(0);
static void putPixelMap(int from, int to) {
pixelMapMap.put(new Util.IntValue(from), new Util.IntValue(to));
private BufferChecks() {
}
static void putGetMap(int enum, int size) {
getMap.put(new Util.IntValue(enum), new Util.IntValue(size));
}
/** The minimum size we'll allow for glGet* operations */
private static final int MIN_BUFFER_SIZE = 16;
/**
* Ensure that a pixel map buffer is big enough
* The minimum size we'll allow for "large" glGet* operations that can
* return lots of data, eg. glGetPixelMap
*/
static void checkPixelMapBuffer(int map, Buffer buf) {
scratchInt.value = map;
Util.IntValue ret = (Util.IntValue) pixelMapMap.get(scratchInt);
if (ret == null) {
throw new OpenGLException("Unknown pixel map value "+map);
} else {
GL11.glGetInteger(ret.value, Util.int_buffer);
int size = Util.int_buffer.get(0);
if (buf.remaining() < size) {
throw new BufferOverflowException();
}
}
}
private static final int MIN_LARGE_BUFFER_SIZE = 256;
/**
* Ensure that a buffer for glGet is big enough
* Helper method to ensure a buffer is big enough to receive data from a
* glGet* operation. To avoid unnecessarily complex buffer size checking
* we've just set the bar artificially high and insist that any receiving
* buffer has at least 16 remaining().
*
* @param buf
* The buffer to check
* @throws BufferOverflowException
*/
static void checkGetBuffer(int enum, Buffer buf) {
scratchInt.value = enum;
Util.IntValue ret = (Util.IntValue) getMap.get(scratchInt);
if (ret == null) {
// TODO: add missing enums before re-enabling this anal check
//throw new OpenGLException("Unknown enum glGet* "+enum);
} else if (buf.remaining() < ret.value) {
static void checkBuffer(Buffer buf) {
if (buf.remaining() < MIN_BUFFER_SIZE) {
throw new BufferOverflowException();
}
}
/**
* Helper method to ensure that vertex buffer objects are disabled.
* If they are enabled, we'll throw an OpenGLException
* Helper method to ensure a buffer is big enough to receive data from a
* "large" glGet* operation. To avoid unnecessarily complex buffer size
* checking we've just set the bar artificially high and insist that any
* receiving buffer has at least 256 remaining().
*
* @param buf
* The buffer to check
* @throws BufferOverflowException
*/
static void checkVBOdisabled() {
static void checkLargeBuffer(Buffer buf) {
if (buf.remaining() < MIN_LARGE_BUFFER_SIZE) {
throw new BufferOverflowException();
}
}
/**
* Helper method to ensure that vertex buffer objects are disabled. If they
* are enabled, we'll throw an OpenGLException
*/
static void ensureVBOdisabled() {
if (VBOTracker.getVBOArrayStack().getState() != 0) {
throw new OpenGLException("Cannot use Buffers when VBO is enabled");
}
}
/**
* Helper method to ensure that vertex buffer objects are enabled.
* If they are disabled, we'll throw an OpenGLException
* Helper method to ensure that vertex buffer objects are enabled. If they
* are disabled, we'll throw an OpenGLException
*/
static void checkVBOenabled() {
static void ensureVBOenabled() {
if (VBOTracker.getVBOArrayStack().getState() == 0) {
throw new OpenGLException("Cannot use offsets when VBO is disabled");
}
}
/**
* Calculate the storage required for an image.
*
* @param format
* The format of the image (example: GL_RGBA)
* @param type
* The type of the image elements (example: GL_UNSIGNED_BYTE)
* @param width
* The width of the image
* @param height
* The height of the image (1 for 1D images)
* @param depth
* The depth of the image (1 for 2D images)
* @return the size, in bytes, of the image
*/
static int calculateImageStorage(int format, int type, int width,
int height, int depth) {
int bpe;
switch (type) {
case GL11.GL_UNSIGNED_BYTE :
case GL11.GL_BYTE :
bpe = 1;
break;
case GL11.GL_UNSIGNED_SHORT :
case GL11.GL_SHORT :
bpe = 2;
break;
case GL11.GL_UNSIGNED_INT :
case GL11.GL_INT :
case GL11.GL_FLOAT :
bpe = 4;
break;
default :
throw new IllegalArgumentException("Unknown type " + type);
}
int epp;
switch (format) {
case GL11.GL_LUMINANCE:
case GL11.GL_ALPHA:
epp = 1;
break;
case GL11.GL_LUMINANCE_ALPHA:
epp = 2;
break;
case GL11.GL_RGB :
case EXTBgra.GL_BGR_EXT :
epp = 3;
break;
case GL11.GL_RGBA :
case EXTAbgr.GL_ABGR_EXT :
case EXTBgra.GL_BGRA_EXT :
epp = 4;
break;
default :
// Assume 4 elements per pixel
epp = 4;
}
return epp * bpe * width * height * depth;
}
}

View File

@ -43,6 +43,7 @@ public class EXTCompiledVertexArray {
public static final int GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = 0x81A8;
public static final int GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = 0x81A9;
public static native void glLockArraysEXT(int first, int count);
public static native void glUnlockArraysEXT();
}

View File

@ -50,21 +50,21 @@ public class EXTDrawRangeElements {
public static final int GL_MAX_ELEMENTS_INDICES_EXT = 0x80E9;
public static void glDrawRangeElementsEXT(int mode, int start, int end, ByteBuffer pIndices) {
assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglDrawRangeElementsEXT(mode, start, end, pIndices.remaining(), GL11.GL_UNSIGNED_BYTE, pIndices, pIndices.position());
}
public static void glDrawRangeElementsEXT(int mode, int start, int end, ShortBuffer pIndices) {
assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglDrawRangeElementsEXT(mode, start, end, pIndices.remaining(), GL11.GL_UNSIGNED_SHORT, pIndices, pIndices.position()<<1);
}
public static void glDrawRangeElementsEXT(int mode, int start, int end, IntBuffer pIndices) {
assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglDrawRangeElementsEXT(mode, start, end, pIndices.remaining(), GL11.GL_UNSIGNED_INT, pIndices, pIndices.position()<<2);
}
private static native void nglDrawRangeElementsEXT(int mode, int start, int end, int count, int type, Buffer pIndices, int pIndices_offset);
public static void glDrawRangeElementsEXT(int mode, int start, int end, int count, int type, int buffer_offset) {
assert VBOTracker.getVBOElementStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.ensureVBOenabled();
nglDrawRangeElementsEXTVBO(mode, start, end, count, type, buffer_offset);
}
private static native void nglDrawRangeElementsEXTVBO(int mode, int start, int end, int count, int type, int buffer_offset);

View File

@ -53,14 +53,15 @@ public class EXTFogCoord {
public static final int GL_FOG_COORDINATE_ARRAY_POINTER_EXT = 0x8456;
public static final int GL_FOG_COORDINATE_ARRAY_EXT = 0x8457;
public static native void glFogCoordfEXT(float coord);
public static void glFogCoordPointerEXT(int stride, FloatBuffer data) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglFogCoordPointerEXT(GL11.GL_FLOAT, stride, data, data.position() << 2);
}
private static native void nglFogCoordPointerEXT(int type, int stride, Buffer data, int data_offset);
public static void glFogCoordPointerEXT(int type, int stride, int buffer_offset) {
assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.ensureVBOenabled();
nglFogCoordPointerEXTVBO(type, stride, buffer_offset);
}
private static native void nglFogCoordPointerEXTVBO(int type, int stride, int buffer_offset);

View File

@ -43,7 +43,9 @@ import java.nio.IntBuffer;
public class EXTMultiDrawArrays {
public static void glMultiDrawArraysEXT(int mode, IntBuffer piFirst, IntBuffer piCount) {
assert piFirst.remaining() == piCount.remaining(): "piFirst.remaining() != piCount.remaining()";
if (piFirst.remaining() != piCount.remaining()) {
throw new IllegalArgumentException("piFirst.remaining() != piCount.remaining()");
}
nglMultiDrawArraysEXT(mode, piFirst, piFirst.position(), piCount, piCount.position(), piFirst.remaining());
}
private static native void nglMultiDrawArraysEXT(int mode, IntBuffer piFirst, int piFirst_offset, IntBuffer piCount, int piCount_offset, int primcount);

View File

@ -50,6 +50,7 @@ public class EXTPointParameters {
public static native void glPointParameterfEXT(int pname, float param);
public static void glPointParameterEXT(int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglPointParameterfvEXT(pname, pfParams, pfParams.position());
}
private static native void nglPointParameterfvEXT(int pname, FloatBuffer pfParams, int pfParams_offset);

View File

@ -52,7 +52,7 @@ public class EXTSecondaryColor {
public static final int GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT = 0x845C;
public static final int GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = 0x845D;
public static final int GL_SECONDARY_COLOR_ARRAY_EXT = 0x845E;
public static native void glSecondaryColor3bEXT(byte red, byte green, byte blue);
public static native void glSecondaryColor3fEXT(float red, float green, float blue);
@ -60,17 +60,17 @@ public class EXTSecondaryColor {
public static native void glSecondaryColor3ubEXT(byte red, byte green, byte blue);
public static void glSecondaryColorPointerEXT(int size, boolean unsigned, int stride, ByteBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglSecondaryColorPointerEXT(size, unsigned ? GL11.GL_UNSIGNED_BYTE: GL11.GL_BYTE, stride, pPointer, pPointer.position());
}
public static void glSecondaryColorPointerEXT(int size, int stride, FloatBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglSecondaryColorPointerEXT(size, GL11.GL_FLOAT, stride, pPointer, pPointer.position()<<2);
}
private static native void nglSecondaryColorPointerEXT(int size, int type, int stride, Buffer pPointer, int pPointer_offset);
public static void glSecondaryColorPointerEXT(int size, int type, int stride, int buffer_offset) {
assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.ensureVBOenabled();
nglSecondaryColorPointerEXTVBO(size, type, stride, buffer_offset);
}
private static native void nglSecondaryColorPointerEXTVBO(int size, int type, int stride, int buffer_offset);

View File

@ -203,12 +203,15 @@ public class EXTVertexShader {
int range,
int components);
public static void glSetInvariantEXT(int id, boolean unsigned, ByteBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglSetInvariantEXT(id, unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, pAddr, pAddr.position());
}
public static void glSetInvariantEXT(int id, boolean unsigned, ShortBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglSetInvariantEXT(id, unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, pAddr, pAddr.position()<<1);
}
public static void glSetInvariantEXT(int id, FloatBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglSetInvariantEXT(id, GL11.GL_FLOAT, pAddr, pAddr.position()<<2);
}
public static void glSetInvariantEXT(int id, boolean unsigned, IntBuffer pAddr) {
@ -217,72 +220,83 @@ public class EXTVertexShader {
private static native void nglSetInvariantEXT(int id, int type, Buffer pAddr, int pAddr_offset);
public static void glSetLocalConstantEXT(int id, boolean unsigned, ByteBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglSetLocalConstantEXT(id, unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, pAddr, pAddr.position());
}
public static void glSetLocalConstantEXT(int id, boolean unsigned, ShortBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglSetLocalConstantEXT(id, unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, pAddr, pAddr.position()<<1);
}
public static void glSetLocalConstantEXT(int id, FloatBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglSetLocalConstantEXT(id, GL11.GL_FLOAT, pAddr, pAddr.position()<<2);
}
public static void glSetLocalConstantEXT(int id, boolean unsigned, IntBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglSetLocalConstantEXT(id, unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, pAddr, pAddr.position()<<2);
}
private static native void nglSetLocalConstantEXT(int id, int type, Buffer pAddr, int pAddr_offset);
public static void glVariantEXT(int id, ByteBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglVariantbvEXT(id, pAddr, pAddr.position());
}
private static native void nglVariantbvEXT(int id, ByteBuffer pAddr, int pAddr_offset);
public static void glVariantEXT(int id, ShortBuffer psAddr) {
BufferChecks.checkBuffer(psAddr);
nglVariantsvEXT(id, psAddr, psAddr.position());
}
private static native void nglVariantsvEXT(int id, ShortBuffer psAddr, int psAddr_offset);
public static void glVariantEXT(int id, FloatBuffer pfAddr) {
BufferChecks.checkBuffer(pfAddr);
nglVariantfvEXT(id, pfAddr, pfAddr.position());
}
private static native void nglVariantfvEXT(int id, FloatBuffer pfAddr, int pfAddr_offset);
public static void glVariantEXT(int id, IntBuffer piAddr) {
BufferChecks.checkBuffer(piAddr);
nglVariantivEXT(id, piAddr, piAddr.position());
}
private static native void nglVariantivEXT(int id, IntBuffer piAddr, int piAddr_offset);
public static void glVariantuEXT(int id, ByteBuffer pAddr) {
BufferChecks.checkBuffer(pAddr);
nglVariantubvEXT(id, pAddr, pAddr.position());
}
private static native void nglVariantubvEXT(int id, ByteBuffer pAddr, int pAddr_offset);
public static void glVariantuEXT(int id, ShortBuffer psAddr) {
BufferChecks.checkBuffer(psAddr);
nglVariantusvEXT(id, psAddr, psAddr.position());
}
private static native void nglVariantusvEXT(int id, ShortBuffer psAddr, int psAddr_offset);
public static void glVariantuEXT(int id, IntBuffer piAddr) {
BufferChecks.checkBuffer(piAddr);
nglVariantuivEXT(id, piAddr, piAddr.position());
}
private static native void nglVariantuivEXT(int id, IntBuffer piAddr, int piAddr_offset);
public static void glVariantPointerEXT(int id, boolean unsigned, int stride, ByteBuffer pAddr) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVariantPointerEXT(id, unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, stride, pAddr, pAddr.position());
}
public static void glVariantPointerEXT(int id, boolean unsigned, int stride, ShortBuffer pAddr) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVariantPointerEXT(id, unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, stride, pAddr, pAddr.position()<<1);
}
public static void glVariantPointerEXT(int id, int stride, FloatBuffer pAddr) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVariantPointerEXT(id, GL11.GL_FLOAT, stride, pAddr, pAddr.position()<<2);
}
public static void glVariantPointerEXT(int id, boolean unsigned, int stride, IntBuffer pAddr) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVariantPointerEXT(id, unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, stride, pAddr, pAddr.position()<<2);
}
private static native void nglVariantPointerEXT(int id, int type, int stride, Buffer pAddr, int pAddr_offset);
public static void glVariantPointerEXT(int id, int type, int stride, int buffer_offset) {
assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.ensureVBOenabled();
nglVariantPointerEXTVBO(id, type, stride, buffer_offset);
}
private static native void nglVariantPointerEXTVBO(int id, int type, int stride, int buffer_offset);

View File

@ -61,12 +61,12 @@ public class EXTVertexWeighting {
public static native void glVertexWeightfEXT(float weight);
public static void glVertexWeightPointerEXT(int size, int stride, FloatBuffer pPointer) {
assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVertexWeightPointerEXT(size, GL11.GL_FLOAT, stride, pPointer, pPointer.position()<<2);
}
private static native void nglVertexWeightPointerEXT(int size, int type, int stride, Buffer pPointer, int pPointer_offset);
public static void glVertexWeightPointerEXT(int size, int type, int stride, int buffer_offset) {
assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled";
BufferChecks.ensureVBOenabled();
nglVertexWeightPointerEXTVBO(size, type, stride, buffer_offset);
}
private static native void nglVertexWeightPointerEXTVBO(int size, int type, int stride, int buffer_offset);

View File

@ -32,6 +32,7 @@
package org.lwjgl.opengl;
import java.nio.*;
import java.nio.Buffer;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
@ -720,222 +721,6 @@ public abstract class GL11 {
public static final int GL_LOGIC_OP = GL_INDEX_LOGIC_OP;
public static final int GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT;
/*
* Register buffer checking maps
*/
static {
// For glGetPixelMap
BufferChecks.putPixelMap(GL_PIXEL_MAP_S_TO_S, GL_PIXEL_MAP_S_TO_S_SIZE);
BufferChecks.putPixelMap(GL_PIXEL_MAP_I_TO_R, GL_PIXEL_MAP_I_TO_R_SIZE);
BufferChecks.putPixelMap(GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_G_SIZE);
BufferChecks.putPixelMap(GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B_SIZE);
BufferChecks.putPixelMap(GL_PIXEL_MAP_I_TO_A, GL_PIXEL_MAP_I_TO_A_SIZE);
BufferChecks.putPixelMap(GL_PIXEL_MAP_R_TO_R, GL_PIXEL_MAP_R_TO_R_SIZE);
BufferChecks.putPixelMap(GL_PIXEL_MAP_G_TO_G, GL_PIXEL_MAP_G_TO_G_SIZE);
BufferChecks.putPixelMap(GL_PIXEL_MAP_B_TO_B, GL_PIXEL_MAP_B_TO_B_SIZE);
BufferChecks.putPixelMap(GL_PIXEL_MAP_B_TO_B, GL_PIXEL_MAP_A_TO_A_SIZE);
// For glGetIntegerv/glGetFloatv/glGetBooleanv/glGetDoublev
BufferChecks.putGetMap(GL_ACCUM_ALPHA_BITS, 1);
BufferChecks.putGetMap(GL_ACCUM_BLUE_BITS, 1);
BufferChecks.putGetMap(GL_ACCUM_CLEAR_VALUE, 4);
BufferChecks.putGetMap(GL_ACCUM_GREEN_BITS, 1);
BufferChecks.putGetMap(GL_ACCUM_RED_BITS, 1);
BufferChecks.putGetMap(GL_ALPHA_BIAS, 1);
BufferChecks.putGetMap(GL_ALPHA_BITS, 1);
BufferChecks.putGetMap(GL_ALPHA_SCALE, 1);
BufferChecks.putGetMap(GL_ALPHA_TEST, 1);
BufferChecks.putGetMap(GL_ALPHA_TEST_FUNC, 1);
BufferChecks.putGetMap(GL_ALPHA_TEST_REF, 1);
BufferChecks.putGetMap(GL_ATTRIB_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_AUTO_NORMAL, 1);
BufferChecks.putGetMap(GL_AUX_BUFFERS, 1);
BufferChecks.putGetMap(GL_BLEND, 1);
BufferChecks.putGetMap(GL_BLEND_DST, 1);
BufferChecks.putGetMap(GL_BLEND_SRC, 1);
BufferChecks.putGetMap(GL_BLUE_BIAS, 1);
BufferChecks.putGetMap(GL_BLUE_BITS, 1);
BufferChecks.putGetMap(GL_BLUE_SCALE, 1);
BufferChecks.putGetMap(GL_CLIP_PLANE0, 1);
BufferChecks.putGetMap(GL_CLIP_PLANE1, 1);
BufferChecks.putGetMap(GL_CLIP_PLANE2, 1);
BufferChecks.putGetMap(GL_CLIP_PLANE3, 1);
BufferChecks.putGetMap(GL_CLIP_PLANE4, 1);
BufferChecks.putGetMap(GL_CLIP_PLANE5, 1);
BufferChecks.putGetMap(GL_COLOR_CLEAR_VALUE, 4);
BufferChecks.putGetMap(GL_COLOR_MATERIAL, 1);
BufferChecks.putGetMap(GL_COLOR_MATERIAL_FACE, 1);
BufferChecks.putGetMap(GL_COLOR_MATERIAL_PARAMETER, 1);
BufferChecks.putGetMap(GL_COLOR_WRITEMASK, 4);
BufferChecks.putGetMap(GL_CULL_FACE, 1);
BufferChecks.putGetMap(GL_CULL_FACE_MODE, 1);
BufferChecks.putGetMap(GL_CURRENT_COLOR, 4);
BufferChecks.putGetMap(GL_CURRENT_INDEX, 1);
BufferChecks.putGetMap(GL_CURRENT_NORMAL, 3);
BufferChecks.putGetMap(GL_CURRENT_RASTER_COLOR, 4);
BufferChecks.putGetMap(GL_CURRENT_RASTER_INDEX, 1);
BufferChecks.putGetMap(GL_CURRENT_RASTER_POSITION, 4);
BufferChecks.putGetMap(GL_CURRENT_RASTER_TEXTURE_COORDS, 4);
BufferChecks.putGetMap(GL_CURRENT_RASTER_POSITION_VALID, 1);
BufferChecks.putGetMap(GL_CURRENT_TEXTURE_COORDS, 4);
BufferChecks.putGetMap(GL_DEPTH_BITS, 1);
BufferChecks.putGetMap(GL_DEPTH_CLEAR_VALUE, 1);
BufferChecks.putGetMap(GL_DEPTH_FUNC, 1);
BufferChecks.putGetMap(GL_DEPTH_RANGE, 2);
BufferChecks.putGetMap(GL_DEPTH_WRITEMASK, 1);
BufferChecks.putGetMap(GL_DOUBLEBUFFER, 1);
BufferChecks.putGetMap(GL_DRAW_BUFFER, 1);
BufferChecks.putGetMap(GL_EDGE_FLAG, 1);
BufferChecks.putGetMap(GL_FOG, 1);
BufferChecks.putGetMap(GL_FOG_COLOR, 4);
BufferChecks.putGetMap(GL_FOG_DENSITY, 1);
BufferChecks.putGetMap(GL_FOG_END, 1);
BufferChecks.putGetMap(GL_FOG_HINT, 1);
BufferChecks.putGetMap(GL_FOG_INDEX, 1);
BufferChecks.putGetMap(GL_FOG_MODE, 1);
BufferChecks.putGetMap(GL_FOG_START, 1);
BufferChecks.putGetMap(GL_FRONT_FACE, 1);
BufferChecks.putGetMap(GL_GREEN_BIAS, 1);
BufferChecks.putGetMap(GL_GREEN_BITS, 1);
BufferChecks.putGetMap(GL_GREEN_SCALE, 1);
BufferChecks.putGetMap(GL_INDEX_BITS, 1);
BufferChecks.putGetMap(GL_INDEX_CLEAR_VALUE, 1);
BufferChecks.putGetMap(GL_INDEX_MODE, 1);
BufferChecks.putGetMap(GL_INDEX_OFFSET, 1);
BufferChecks.putGetMap(GL_INDEX_SHIFT, 1);
BufferChecks.putGetMap(GL_INDEX_WRITEMASK, 1);
BufferChecks.putGetMap(GL_LIGHT0, 1);
BufferChecks.putGetMap(GL_LIGHT1, 1);
BufferChecks.putGetMap(GL_LIGHT2, 1);
BufferChecks.putGetMap(GL_LIGHT3, 1);
BufferChecks.putGetMap(GL_LIGHT4, 1);
BufferChecks.putGetMap(GL_LIGHT5, 1);
BufferChecks.putGetMap(GL_LIGHT6, 1);
BufferChecks.putGetMap(GL_LIGHT7, 1);
BufferChecks.putGetMap(GL_LIGHTING, 1);
BufferChecks.putGetMap(GL_LIGHT_MODEL_AMBIENT, 4);
BufferChecks.putGetMap(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
BufferChecks.putGetMap(GL_LIGHT_MODEL_TWO_SIDE, 1);
BufferChecks.putGetMap(GL_LINE_SMOOTH, 1);
BufferChecks.putGetMap(GL_LINE_STIPPLE, 1);
BufferChecks.putGetMap(GL_LINE_STIPPLE_PATTERN, 1);
BufferChecks.putGetMap(GL_LINE_STIPPLE_REPEAT, 1);
BufferChecks.putGetMap(GL_LINE_WIDTH, 1);
BufferChecks.putGetMap(GL_LINE_WIDTH_GRANULARITY, 1);
BufferChecks.putGetMap(GL_LINE_WIDTH_RANGE, 2);
BufferChecks.putGetMap(GL_LIST_BASE, 1);
BufferChecks.putGetMap(GL_LIST_INDEX, 1);
BufferChecks.putGetMap(GL_LIST_MODE, 1);
BufferChecks.putGetMap(GL_LOGIC_OP, 1);
BufferChecks.putGetMap(GL_LOGIC_OP_MODE, 1);
BufferChecks.putGetMap(GL_MAP1_COLOR_4, 1);
BufferChecks.putGetMap(GL_MAP1_GRID_DOMAIN, 2);
BufferChecks.putGetMap(GL_MAP1_GRID_SEGMENTS, 1);
BufferChecks.putGetMap(GL_MAP1_INDEX, 1);
BufferChecks.putGetMap(GL_MAP1_NORMAL, 1);
BufferChecks.putGetMap(GL_MAP1_TEXTURE_COORD_1, 1);
BufferChecks.putGetMap(GL_MAP1_TEXTURE_COORD_2, 1);
BufferChecks.putGetMap(GL_MAP1_TEXTURE_COORD_3, 1);
BufferChecks.putGetMap(GL_MAP1_TEXTURE_COORD_4, 1);
BufferChecks.putGetMap(GL_MAP1_VERTEX_3, 1);
BufferChecks.putGetMap(GL_MAP1_VERTEX_4, 1);
BufferChecks.putGetMap(GL_MAP2_COLOR_4, 1);
BufferChecks.putGetMap(GL_MAP2_GRID_DOMAIN, 4);
BufferChecks.putGetMap(GL_MAP2_GRID_SEGMENTS, 2);
BufferChecks.putGetMap(GL_MAP2_INDEX, 1);
BufferChecks.putGetMap(GL_MAP2_NORMAL, 1);
BufferChecks.putGetMap(GL_MAP2_TEXTURE_COORD_1, 1);
BufferChecks.putGetMap(GL_MAP2_TEXTURE_COORD_2, 1);
BufferChecks.putGetMap(GL_MAP2_TEXTURE_COORD_3, 1);
BufferChecks.putGetMap(GL_MAP2_TEXTURE_COORD_4, 1);
BufferChecks.putGetMap(GL_MAP2_VERTEX_3, 1);
BufferChecks.putGetMap(GL_MAP2_VERTEX_4, 1);
BufferChecks.putGetMap(GL_MAP_COLOR, 1);
BufferChecks.putGetMap(GL_MAP_STENCIL, 1);
BufferChecks.putGetMap(GL_MATRIX_MODE, 1);
BufferChecks.putGetMap(GL_MAX_ATTRIB_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_MAX_CLIP_PLANES, 1);
BufferChecks.putGetMap(GL_MAX_EVAL_ORDER, 1);
BufferChecks.putGetMap(GL_MAX_LIGHTS, 1);
BufferChecks.putGetMap(GL_MAX_LIST_NESTING, 1);
BufferChecks.putGetMap(GL_MAX_MODELVIEW_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_MAX_NAME_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_MAX_PIXEL_MAP_TABLE, 1);
BufferChecks.putGetMap(GL_MAX_PROJECTION_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_MAX_TEXTURE_SIZE, 1);
BufferChecks.putGetMap(GL_MAX_TEXTURE_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_MAX_VIEWPORT_DIMS, 2);
BufferChecks.putGetMap(GL_MODELVIEW_MATRIX, 16);
BufferChecks.putGetMap(GL_MODELVIEW_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_NAME_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_NORMALIZE, 1);
BufferChecks.putGetMap(GL_PACK_ALIGNMENT, 1);
BufferChecks.putGetMap(GL_PACK_LSB_FIRST, 1);
BufferChecks.putGetMap(GL_PACK_ROW_LENGTH, 1);
BufferChecks.putGetMap(GL_PACK_SKIP_PIXELS, 1);
BufferChecks.putGetMap(GL_PACK_SKIP_ROWS, 1);
BufferChecks.putGetMap(GL_PACK_SWAP_BYTES, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_A_TO_A_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_B_TO_B_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_G_TO_G_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_I_TO_A_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_I_TO_B_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_I_TO_G_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_I_TO_I_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_I_TO_R_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_R_TO_R_SIZE, 1);
BufferChecks.putGetMap(GL_PIXEL_MAP_S_TO_S_SIZE, 1);
BufferChecks.putGetMap(GL_POINT_SIZE, 1);
BufferChecks.putGetMap(GL_POINT_SIZE_GRANULARITY, 1);
BufferChecks.putGetMap(GL_POINT_SIZE_RANGE, 2);
BufferChecks.putGetMap(GL_POINT_SMOOTH, 1);
BufferChecks.putGetMap(GL_POLYGON_MODE, 2);
BufferChecks.putGetMap(GL_POLYGON_SMOOTH, 1);
BufferChecks.putGetMap(GL_POLYGON_STIPPLE, 1);
BufferChecks.putGetMap(GL_PROJECTION_MATRIX, 16);
BufferChecks.putGetMap(GL_PROJECTION_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_READ_BUFFER, 1);
BufferChecks.putGetMap(GL_RED_BIAS, 1);
BufferChecks.putGetMap(GL_RED_BITS, 1);
BufferChecks.putGetMap(GL_RED_SCALE, 1);
BufferChecks.putGetMap(GL_RENDER_MODE, 1);
BufferChecks.putGetMap(GL_RGBA_MODE, 1);
BufferChecks.putGetMap(GL_SCISSOR_BOX, 4);
BufferChecks.putGetMap(GL_SCISSOR_TEST, 1);
BufferChecks.putGetMap(GL_SHADE_MODEL, 1);
BufferChecks.putGetMap(GL_STENCIL_BITS, 1);
BufferChecks.putGetMap(GL_STENCIL_CLEAR_VALUE, 1);
BufferChecks.putGetMap(GL_STENCIL_FAIL, 1);
BufferChecks.putGetMap(GL_STENCIL_FUNC, 1);
BufferChecks.putGetMap(GL_STENCIL_PASS_DEPTH_FAIL, 1);
BufferChecks.putGetMap(GL_STENCIL_PASS_DEPTH_PASS, 1);
BufferChecks.putGetMap(GL_STENCIL_REF, 1);
BufferChecks.putGetMap(GL_STENCIL_TEST, 1);
BufferChecks.putGetMap(GL_STENCIL_VALUE_MASK, 1);
BufferChecks.putGetMap(GL_STENCIL_WRITEMASK, 1);
BufferChecks.putGetMap(GL_STEREO, 1);
BufferChecks.putGetMap(GL_SUBPIXEL_BITS, 1);
BufferChecks.putGetMap(GL_TEXTURE_1D, 1);
BufferChecks.putGetMap(GL_TEXTURE_2D, 1);
BufferChecks.putGetMap(GL_TEXTURE_GEN_S, 1);
BufferChecks.putGetMap(GL_TEXTURE_GEN_T, 1);
BufferChecks.putGetMap(GL_TEXTURE_GEN_R, 1);
BufferChecks.putGetMap(GL_TEXTURE_GEN_Q, 1);
BufferChecks.putGetMap(GL_TEXTURE_MATRIX, 16);
BufferChecks.putGetMap(GL_TEXTURE_STACK_DEPTH, 1);
BufferChecks.putGetMap(GL_UNPACK_ALIGNMENT, 1);
BufferChecks.putGetMap(GL_UNPACK_LSB_FIRST, 1);
BufferChecks.putGetMap(GL_UNPACK_ROW_LENGTH, 1);
BufferChecks.putGetMap(GL_UNPACK_SKIP_PIXELS, 1);
BufferChecks.putGetMap(GL_UNPACK_SKIP_ROWS, 1);
BufferChecks.putGetMap(GL_UNPACK_SWAP_BYTES, 1);
BufferChecks.putGetMap(GL_VIEWPORT, 4);
BufferChecks.putGetMap(GL_ZOOM_X, 1);
BufferChecks.putGetMap(GL_ZOOM_Y, 1);
}
public static native void glAccum(int op, float value);
public static native void glAlphaFunc(int func, float ref);
public static native void glClearColor(float red, float green, float blue, float alpha);
@ -954,7 +739,9 @@ public abstract class GL11 {
public static native void glCallList(int list);
public static native void glBlendFunc(int sfactor, int dfactor);
public static void glBitmap(int width, int height, float xorig, float yorig, float xmove, float ymove, ByteBuffer bitmap) {
// TODO: check buffer size valid
if (bitmap.remaining() < width * height) {
throw new BufferUnderflowException();
}
nglBitmap(width, height, xorig, yorig, xmove, ymove, bitmap, bitmap.position());
}
private static native void nglBitmap(int width, int height, float xorig, float yorig, float xmove, float ymove, ByteBuffer bitmap, int bitmap_offset);
@ -976,16 +763,16 @@ public abstract class GL11 {
public static native void glCopyPixels(int x, int y, int width, int height, int type);
public static void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglColorPointer(size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, pointer, pointer.position());
}
public static void glColorPointer(int size, int stride, FloatBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglColorPointer(size, GL_FLOAT, stride, pointer, pointer.position() << 2);
}
private static native void nglColorPointer(int size, int type, int stride, Buffer pointer, int pointer_offset);
public static void glColorPointer(int size, int type, int stride, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglColorPointerVBO(size, type, stride, buffer_offset);
}
private static native void nglColorPointerVBO(int size, int type, int stride, int buffer_offset);
@ -1017,44 +804,50 @@ public abstract class GL11 {
public static native void glEnable(int cap);
public static native void glDisable(int cap);
public static void glEdgeFlagPointer(int stride, ByteBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglEdgeFlagPointer(stride, pointer, pointer.position());
}
private static native void nglEdgeFlagPointer(int stride, Buffer pointer, int pointer_offset);
public static void glEdgeFlagPointer(int stride, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglEdgeFlagPointerVBO(stride, buffer_offset);
}
private static native void nglEdgeFlagPointerVBO(int stride, int buffer_offset);
public static native void glEdgeFlag(boolean flag);
public static void glDrawPixels(int width, int height, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferUnderflowException();
}
nglDrawPixels(width, height, format, type, pixels, pixels.position());
}
public static void glDrawPixels(int width, int height, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferUnderflowException();
}
nglDrawPixels(width, height, format, type, pixels, pixels.position() << 1);
}
public static void glDrawPixels(int width, int height, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferUnderflowException();
}
nglDrawPixels(width, height, format, type, pixels, pixels.position() << 2);
}
private static native void nglDrawPixels(int width, int height, int format, int type, Buffer pixels, int pixels_offset);
public static void glDrawElements(int mode, ByteBuffer indices) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_BYTE, indices, indices.position());
}
public static void glDrawElements(int mode, ShortBuffer indices) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_SHORT, indices, indices.position() << 1);
}
public static void glDrawElements(int mode, IntBuffer indices) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_INT, indices, indices.position() << 2);
}
private static native void nglDrawElements(int mode, int count, int type, Buffer indices, int indices_offset);
public static void glDrawElements(int mode, int count, int type, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglDrawElementsVBO(mode, count, type, buffer_offset);
}
private static native void nglDrawElementsVBO(int mode, int count, int type, int buffer_offset);
@ -1069,75 +862,73 @@ public abstract class GL11 {
private static native void nglFeedbackBuffer(int size, int type, FloatBuffer buffer, int buffer_offset);
public static void glGetPixelMap(int map, FloatBuffer values) {
BufferChecks.checkPixelMapBuffer(map, values);
BufferChecks.checkLargeBuffer(values);
nglGetPixelMapfv(map, values, values.position());
}
private static native void nglGetPixelMapfv(int map, FloatBuffer values, int values_offset);
public static void glGetPixelMap(int map, IntBuffer values) {
BufferChecks.checkPixelMapBuffer(map, values);
BufferChecks.checkLargeBuffer(values);
nglGetPixelMapuiv(map, values, values.position());
}
private static native void nglGetPixelMapuiv(int map, IntBuffer values, int values_offset);
public static void glGetPixelMap(int map, ShortBuffer values) {
BufferChecks.checkPixelMapBuffer(map, values);
BufferChecks.checkLargeBuffer(values);
nglGetPixelMapusv(map, values, values.position());
}
private static native void nglGetPixelMapusv(int map, ShortBuffer values, int values_offset);
public static void glGetMaterial(int face, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetMaterialfv(face, pname, params, params.position());
}
private static native void nglGetMaterialfv(int face, int pname, FloatBuffer params, int params_offset);
public static void glGetMaterial(int face, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetMaterialiv(face, pname, params, params.position());
}
private static native void nglGetMaterialiv(int face, int pname, IntBuffer params, int params_offset);
public static void glGetMap(int target, int query, FloatBuffer v) {
// TODO: check buffer size valid
BufferChecks.checkLargeBuffer(v);
nglGetMapfv(target, query, v, v.position());
}
public static void glGetMap(int target, int query, IntBuffer v) {
// TODO: check buffer size valid
BufferChecks.checkLargeBuffer(v);
nglGetMapiv(target, query, v, v.position());
}
private static native void nglGetMapfv(int target, int query, FloatBuffer v, int v_offset);
private static native void nglGetMapiv(int target, int query, IntBuffer v, int v_offset);
public static void glGetLight(int light, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetLightfv(light, pname, params, params.position());
}
private static native void nglGetLightfv(int light, int pname, FloatBuffer params, int params_offset);
public static void glGetLight(int light, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetLightiv(light, pname, params, params.position());
}
private static native void nglGetLightiv(int light, int pname, IntBuffer params, int params_offset);
public static native int glGetError();
public static void glGetClipPlane(int plane, DoubleBuffer equation) {
if (equation.remaining() < 4) {
throw new BufferUnderflowException();
}
BufferChecks.checkBuffer(equation);
nglGetClipPlane(plane, equation, equation.position());
}
private static native void nglGetClipPlane(int plane, DoubleBuffer equation, int equation_offset);
public static void glGetBoolean(int pname, ByteBuffer params) {
BufferChecks.checkGetBuffer(pname, params);
BufferChecks.checkBuffer(params);
nglGetBooleanv(pname, params, params.position());
}
private static native void nglGetBooleanv(int pname, ByteBuffer params, int params_offset);
public static void glGetDouble(int pname, DoubleBuffer params) {
BufferChecks.checkGetBuffer(pname, params);
BufferChecks.checkBuffer(params);
nglGetDoublev(pname, params, params.position());
}
private static native void nglGetDoublev(int pname, DoubleBuffer params, int params_offset);
public static void glGetFloat(int pname, FloatBuffer params) {
BufferChecks.checkGetBuffer(pname, params);
BufferChecks.checkBuffer(params);
nglGetFloatv(pname, params, params.position());
}
private static native void nglGetFloatv(int pname, FloatBuffer params, int params_offset);
public static void glGetInteger(int pname, IntBuffer params) {
BufferChecks.checkGetBuffer(pname, params);
BufferChecks.checkBuffer(params);
nglGetIntegerv(pname, params, params.position());
}
private static native void nglGetIntegerv(int pname, IntBuffer params, int params_offset);
@ -1151,12 +942,12 @@ public abstract class GL11 {
public static native void glFogf(int pname, float param);
public static native void glFogi(int pname, int param);
public static void glFog(int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglFogfv(pname, params, params.position());
}
private static native void nglFogfv(int pname, FloatBuffer params, int params_offset);
public static void glFog(int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglFogiv(pname, params, params.position());
}
private static native void nglFogiv(int pname, IntBuffer params, int params_offset);
@ -1172,76 +963,91 @@ public abstract class GL11 {
public static native ByteBuffer glGetPointerv(int pname, int size);
public static native boolean glIsEnabled(int cap);
public static void glInterleavedArrays(int format, int stride, ByteBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglInterleavedArrays(format, stride, pointer, pointer.position());
}
public static void glInterleavedArrays(int format, int stride, ShortBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglInterleavedArrays(format, stride, pointer, pointer.position() << 1);
}
public static void glInterleavedArrays(int format, int stride, IntBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglInterleavedArrays(format, stride, pointer, pointer.position() << 2);
}
public static void glInterleavedArrays(int format, int stride, FloatBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglInterleavedArrays(format, stride, pointer, pointer.position() << 2);
}
private static native void nglInterleavedArrays(int format, int stride, Buffer pointer, int pointer_offset);
public static void glInterleavedArrays(int format, int stride, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglInterleavedArraysVBO(format, stride, buffer_offset);
}
private static native void nglInterleavedArraysVBO(int format, int stride, int buffer_offset);
public static native void glInitNames();
public static native void glHint(int target, int mode);
public static void glGetTexParameter(int target, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetTexParameterfv(target, pname, params, params.position());
}
private static native void nglGetTexParameterfv(int target, int pname, FloatBuffer params, int params_offset);
public static void glGetTexParameter(int target, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetTexParameteriv(target, pname, params, params.position());
}
private static native void nglGetTexParameteriv(int target, int pname, IntBuffer params, int params_offset);
public static void glGetTexLevelParameter(int target, int level, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetTexLevelParameterfv(target, level, pname, params, params.position());
}
private static native void nglGetTexLevelParameterfv(int target, int level, int pname, FloatBuffer params, int params_offset);
public static void glGetTexLevelParameter(int target, int level, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetTexLevelParameteriv(target, level, pname, params, params.position());
}
private static native void nglGetTexLevelParameteriv(int target, int level, int pname, IntBuffer params, int params_offset);
public static void glGetTexImage(int target, int level, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
int width = 1;
int height = 1;
int depth = 1;
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglGetTexImage(target, level, format, type, pixels, pixels.position());
}
public static void glGetTexImage(int target, int level, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
int width = 1;
int height = 1;
int depth = 1;
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglGetTexImage(target, level, format, type, pixels, pixels.position() << 1);
}
public static void glGetTexImage(int target, int level, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
int width = 1;
int height = 1;
int depth = 1;
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglGetTexImage(target, level, format, type, pixels, pixels.position() << 2);
}
private static native void nglGetTexImage(int target, int level, int format, int type, Buffer pixels, int pixels_offset);
public static void glGetTexGen(int coord, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetTexGenfv(coord, pname, params, params.position());
}
private static native void nglGetTexGenfv(int coord, int pname, FloatBuffer params, int params_offset);
public static void glGetTexEnv(int coord, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetTexEnviv(coord, pname, params, params.position());
}
private static native void nglGetTexEnviv(int coord, int pname, IntBuffer params, int params_offset);
public static void glGetTexEnv(int coord, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetTexEnvfv(coord, pname, params, params.position());
}
private static native void nglGetTexEnvfv(int coord, int pname, FloatBuffer params, int params_offset);
@ -1250,6 +1056,9 @@ public abstract class GL11 {
public static void glGetPolygonStipple(ByteBuffer mask) {
// TODO: check buffer size valid. This is a bit more fiddly than you might think;
// it looks like a 32x32 byte array but it might not be according to the spec :/
if (mask.remaining() < 32 * 32) {
throw new BufferOverflowException();
}
nglGetPolygonStipple(mask, mask.position());
}
private static native void nglGetPolygonStipple(ByteBuffer mask, int mask_offset);
@ -1257,12 +1066,12 @@ public abstract class GL11 {
public static native void glMaterialf(int face, int pname, float param);
public static native void glMateriali(int face, int pname, int param);
public static void glMaterial(int face, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglMaterialfv(face, pname, params, params.position());
}
private static native void nglMaterialfv(int face, int pname, FloatBuffer params, int params_offset);
public static void glMaterial(int face, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglMaterialiv(face, pname, params, params.position());
}
private static native void nglMaterialiv(int face, int pname, IntBuffer params, int params_offset);
@ -1281,9 +1090,7 @@ public abstract class GL11 {
public static native void glLogicOp(int opcode);
public static native void glLoadName(int name);
public static void glLoadMatrix(FloatBuffer m) {
if (m.remaining() < 16) {
throw new BufferUnderflowException();
}
BufferChecks.checkBuffer(m);
nglLoadMatrixf(m, m.position());
}
private static native void nglLoadMatrixf(FloatBuffer m, int m_offset);
@ -1294,24 +1101,24 @@ public abstract class GL11 {
public static native void glLightModelf(int pname, float param);
public static native void glLightModeli(int pname, int param);
public static void glLightModel(int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglLightModelfv( pname, params, params.position());
}
private static native void nglLightModelfv(int pname, FloatBuffer params, int params_offset);
public static void glLightModel(int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglLightModeliv(pname, params, params.position());
}
private static native void nglLightModeliv(int pname, IntBuffer params, int params_offset);
public static native void glLightf(int light, int pname, float param);
public static native void glLighti(int light, int pname, int param);
public static void glLightfv(int light, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglLightfv(light, pname, params, params.position());
}
private static native void nglLightfv(int light, int pname, FloatBuffer params, int params_offset);
public static void glLightiv(int light, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglLightiv(light, pname, params, params.position());
}
private static native void nglLightiv(int light, int pname, IntBuffer params, int params_offset);
@ -1319,6 +1126,9 @@ public abstract class GL11 {
public static native void glMatrixMode(int mode);
public static void glPolygonStipple(ByteBuffer mask) {
// TODO: check buffer size valid (again, possibly more complicated than it first appears)
if (mask.remaining() < 32 * 32) {
throw new BufferUnderflowException();
}
nglPolygonStipple(mask, mask.position());
}
private static native void nglPolygonStipple(ByteBuffer mask, int mask_offset);
@ -1331,37 +1141,34 @@ public abstract class GL11 {
public static native void glPixelStoref(int pname, float param);
public static native void glPixelStorei(int pname, int param);
public static void glPixelMap(int map, FloatBuffer values) {
// TODO: check buffer size valid
nglPixelMapfv(map, values.remaining(), values, values.position());
}
private static native void nglPixelMapfv(int map, int mapsize, FloatBuffer values, int values_offset);
public static void glPixelMap(int map, IntBuffer values) {
// TODO: check buffer size valid
nglPixelMapuiv(map, values.remaining(), values, values.position());
}
private static native void nglPixelMapuiv(int map, int mapsize, IntBuffer values, int values_offset);
public static void glPixelMap(int map, ShortBuffer values) {
// TODO: check buffer size valid
nglPixelMapusv(map, values.remaining(), values, values.position());
}
private static native void nglPixelMapusv(int map, int mapsize, ShortBuffer values, int values_offset);
public static native void glPassThrough(float token);
public static native void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar);
public static void glNormalPointer(int stride, ByteBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglNormalPointer(GL_BYTE, stride, pointer, pointer.position());
}
public static void glNormalPointer(int stride, IntBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglNormalPointer(GL_INT, stride, pointer, pointer.position() << 2);
}
public static void glNormalPointer(int stride, FloatBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglNormalPointer(GL_FLOAT, stride, pointer, pointer.position() << 2);
}
private static native void nglNormalPointer(int type, int stride, Buffer pointer, int pointer_offset);
public static void glNormalPointer(int type, int stride, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglNormalPointerVBO(type, stride, buffer_offset);
}
private static native void nglNormalPointerVBO(int type, int stride, int buffer_offset);
@ -1371,9 +1178,7 @@ public abstract class GL11 {
public static native void glNewList(int list, int mode);
public static native void glEndList();
public static void glMultMatrixf(FloatBuffer m) {
if (m.remaining() < 16) {
throw new BufferUnderflowException();
}
BufferChecks.checkBuffer(m);
nglMultMatrixf(m, m.position());
}
private static native void nglMultMatrixf(FloatBuffer m, int m_offset);
@ -1389,15 +1194,21 @@ public abstract class GL11 {
public static native void glRectf(float x1, float y1, float x2, float y2);
public static native void glRecti(int x1, int y1, int x2, int y2);
public static void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglReadPixels(x, y, width, height, format, type, pixels, pixels.position());
}
public static void glReadPixels(int x, int y, int width, int height, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglReadPixels(x, y, width, height, format, type, pixels, pixels.position() << 1);
}
public static void glReadPixels(int x, int y, int width, int height, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglReadPixels(x, y, width, height, format, type, pixels, pixels.position() << 2);
}
private static native void nglReadPixels(int x, int y, int width, int height, int format, int type, Buffer pixels, int pixels_offset);
@ -1434,16 +1245,16 @@ public abstract class GL11 {
public static native void glPopAttrib();
public static native void glStencilFunc(int func, int ref, int mask);
public static void glVertexPointer(int size, int stride, FloatBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglVertexPointer(size, GL_FLOAT, stride, pointer, pointer.position() << 2);
}
public static void glVertexPointer(int size, int stride, IntBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglVertexPointer(size, GL_INT, stride, pointer, pointer.position() << 2);
}
private static native void nglVertexPointer(int size, int type, int stride, Buffer pointer, int pointer_offset);
public static void glVertexPointer(int size, int type, int stride, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglVertexPointerVBO(size, type, stride, buffer_offset);
}
private static native void nglVertexPointerVBO(int size, int type, int stride, int buffer_offset);
@ -1455,108 +1266,136 @@ public abstract class GL11 {
public static native void glVertex4i(int x, int y, int z, int w);
public static native void glTranslatef(float x, float y, float z);
public static void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels, pixels.position());
}
public static void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels, pixels.position() << 1);
}
public static void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels, pixels.position() << 2);
}
private static native void nglTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, Buffer pixels, int pixels_offset);
public static void glTexSubImage1D(int target, int level, int xoffset, int width, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, 1, 1)) {
throw new BufferOverflowException();
}
nglTexSubImage1D(target, level, xoffset, width, format, type, pixels, pixels.position());
}
public static void glTexSubImage1D(int target, int level, int xoffset, int width, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, 1, 1)) {
throw new BufferOverflowException();
}
nglTexSubImage1D(target, level, xoffset, width, format, type, pixels, pixels.position() << 1);
}
public static void glTexSubImage1D(int target, int level, int xoffset, int width, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, 1, 1)) {
throw new BufferOverflowException();
}
nglTexSubImage1D(target, level, xoffset, width, format, type, pixels, pixels.position() << 2);
}
private static native void nglTexSubImage1D(int target, int level, int xoffset, int width, int format, int type, Buffer pixels, int pixels_offset);
public static native void glTexParameterf(int target, int pname, float param);
public static native void glTexParameteri(int target, int pname, int param);
public static void glTexParameter(int target, int pname, FloatBuffer param) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(param);
nglTexParameterfv(target, pname, param, param.position());
}
private static native void nglTexParameterfv(int target, int pname, FloatBuffer param, int param_position);
public static void glTexParameter(int target, int pname, IntBuffer param) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(param);
nglTexParameteriv(target, pname, param, param.position());
}
private static native void nglTexParameteriv(int target, int pname, IntBuffer param, int param_position);
public static void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglTexImage2D(target, level, internalformat, width, height, border, format, type, pixels, pixels.position());
}
public static void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglTexImage2D(target, level, internalformat, width, height, border, format, type, pixels, pixels.position() << 1);
}
public static void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglTexImage2D(target, level, internalformat, width, height, border, format, type, pixels, pixels.position() << 2);
}
public static void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, FloatBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, 1)) {
throw new BufferOverflowException();
}
nglTexImage2D(target, level, internalformat, width, height, border, format, type, pixels, pixels.position() << 2);
}
private static native void nglTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, Buffer pixels, int pixels_offset);
public static void glTexImage1D(int target, int level, int internalformat, int width, int border, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, 1, 1)) {
throw new BufferOverflowException();
}
nglTexImage1D(target, level, internalformat, width, border, format, type, pixels, pixels.position());
}
public static void glTexImage1D(int target, int level, int internalformat, int width, int border, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, 1, 1)) {
throw new BufferOverflowException();
}
nglTexImage1D(target, level, internalformat, width, border, format, type, pixels, pixels.position() << 1);
}
public static void glTexImage1D(int target, int level, int internalformat, int width, int border, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, 1, 1)) {
throw new BufferOverflowException();
}
nglTexImage1D(target, level, internalformat, width, border, format, type, pixels, pixels.position() << 2);
}
public static void glTexImage1D(int target, int level, int internalformat, int width, int border, int format, int type, FloatBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, 1, 1)) {
throw new BufferOverflowException();
}
nglTexImage1D(target, level, internalformat, width, border, format, type, pixels, pixels.position() << 2);
}
private static native void nglTexImage1D(int target, int level, int internalformat, int width, int border, int format, int type, Buffer pixels, int pixels_offset);
public static native void glTexGenf(int coord, int pname, float param);
public static void glTexGen(int coord, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglTexGenfv(coord, pname, params, params.position());
}
private static native void nglTexGenfv(int coord, int pname, FloatBuffer params, int params_offset);
public static native void glTexGeni(int coord, int pname, int param);
public static void glTexGen(int coord, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglTexGeniv(coord, pname, params, params.position());
}
private static native void nglTexGeniv(int coord, int pname, IntBuffer params, int params_offset);
public static native void glTexEnvf(int target, int pname, float param);
public static native void glTexEnvi(int target, int pname, int param);
public static void glTexEnv(int target, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglTexEnvfv(target, pname, params, params.position());
}
private static native void nglTexEnvfv(int target, int pname, FloatBuffer params, int params_offset);
public static void glTexEnv(int target, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglTexEnviv(target, pname, params, params.position());
}
private static native void nglTexEnviv(int target, int pname, IntBuffer params, int params_offset);
public static void glTexCoordPointer(int size, int stride, FloatBuffer pointer) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglTexCoordPointer(size, GL_FLOAT, stride, pointer, pointer.position() << 2);
}
private static native void nglTexCoordPointer(int size, int type, int stride, Buffer pointer, int pointer_offset);
public static void glTexCoordPointer(int size, int type, int stride, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglTexCoordPointerVBO(size, type, stride, buffer_offset);
}
private static native void nglTexCoordPointerVBO(int size, int type, int stride, int buffer_offset);

View File

@ -33,6 +33,7 @@
package org.lwjgl.opengl;
import java.nio.Buffer;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
@ -232,41 +233,41 @@ public abstract class GL12 extends GL11 {
}
private static native void nglGetHistogram(int target, boolean reset, int format, int type, Buffer values, int values_offset);
public static void glGetHistogramParameter(int target, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetHistogramParameterfv(target, pname, params, params.position());
}
private static native void nglGetHistogramParameterfv(int target, int pname, FloatBuffer params, int params_offset);
public static void glGetHistogramParameter(int target, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetHistogramParameteriv(target, pname, params, params.position());
}
private static native void nglGetHistogramParameteriv(int target, int pname, IntBuffer params, int params_offset);
public static native void glMinmax(int target, int internalformat, boolean sink);
public static native void glResetMinmax(int target);
public static void glGetMinmax(int target, boolean reset, int format, int types, ByteBuffer values) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(values);
nglGetMinmax(target, reset, format, types, values, values.position());
}
public static void glGetMinmax(int target, boolean reset, int format, int types, ShortBuffer values) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(values);
nglGetMinmax(target, reset, format, types, values, values.position() << 1);
}
public static void glGetMinmax(int target, boolean reset, int format, int types, IntBuffer values) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(values);
nglGetMinmax(target, reset, format, types, values, values.position() << 2);
}
public static void glGetMinmax(int target, boolean reset, int format, int types, FloatBuffer values) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(values);
nglGetMinmax(target, reset, format, types, values, values.position() << 2);
}
private static native void nglGetMinmax(int target, boolean reset, int format, int types, Buffer values, int values_offset);
public static void glGetMinmaxParameter(int target, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetMinmaxParameterfv(target, pname, params, params.position());
}
private static native void nglGetMinmaxParameterfv(int target, int pname, FloatBuffer params, int params_offset);
public static void glGetMinmaxParameter(int target, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglGetMinmaxParameteriv(target, pname, params, params.position());
}
private static native void nglGetMinmaxParameteriv(int target, int pname, IntBuffer params, int params_offset);
@ -292,13 +293,13 @@ public abstract class GL12 extends GL11 {
private static native void nglConvolutionFilter2D(int target, int internalformat, int width, int height, int format, int type, Buffer image, int image_offset);
public static native void glConvolutionParameterf(int target, int pname, float params);
public static void glConvolutionParameter(int target, int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglConvolutionParameterfv(target, pname, params, params.position());
}
private static native void nglConvolutionParameterfv(int target, int pname, FloatBuffer params, int params_offset);
public static native void glConvolutionParameteri(int target, int pname, int params);
public static void glConvolutionParameteriv(int target, int pname, IntBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglConvolutionParameteriv(target, pname, params, params.position());
}
private static native void nglConvolutionParameteriv(int target, int pname, IntBuffer params, int params_offset);
@ -342,54 +343,70 @@ public abstract class GL12 extends GL11 {
}
private static native void nglGetSeparableFilter(int target, int format, int type, Buffer row, int row_offset, Buffer column, int column_offset, Buffer span, int span_offset);
public static void glDrawRangeElements(int mode, int start, int end, ByteBuffer indices) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglDrawRangeElements(mode, start, end, indices.remaining(), GL_UNSIGNED_BYTE, indices, indices.position());
}
public static void glDrawRangeElements(int mode, int start, int end, ShortBuffer indices) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglDrawRangeElements(mode, start, end, indices.remaining(), GL_UNSIGNED_SHORT, indices, indices.position() << 1);
}
public static void glDrawRangeElements(int mode, int start, int end, IntBuffer indices) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglDrawRangeElements(mode, start, end, indices.remaining(), GL_UNSIGNED_INT, indices, indices.position() << 2);
}
private static native void nglDrawRangeElements(int mode, int start, int end, int count, int type, Buffer indices, int indices_offset);
public static void glDrawRangeElements(int mode, int start, int end, int count, int type, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglDrawRangeElementsVBO(mode, start, end, count, type, buffer_offset);
}
private static native void nglDrawRangeElementsVBO(int mode, int start, int end, int count, int type, int buffer_offset);
public static void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels, pixels.position());
}
public static void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels, pixels.position() << 1);
}
public static void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels, pixels.position() << 2);
}
public static void glTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, FloatBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels, pixels.position() << 2);
}
private static native void nglTexImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, Buffer pixels, int pixels_offset);
public static void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, ByteBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, pixels.position());
}
public static void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, ShortBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 2 < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, pixels.position() << 1);
}
public static void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, IntBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, pixels.position() << 2);
}
public static void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, FloatBuffer pixels) {
// TODO: check buffer size valid
if (pixels.remaining() * 4 < BufferChecks.calculateImageStorage(format, type, width, height, depth)) {
throw new BufferUnderflowException();
}
nglTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, pixels.position() << 2);
}
private static native void nglTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, Buffer pixels, int pixels_offset);

View File

@ -33,7 +33,6 @@
package org.lwjgl.opengl;
import java.nio.Buffer;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
@ -153,104 +152,80 @@ public abstract class GL13 extends GL12 {
public static native void glActiveTexture(int texture);
public static native void glClientActiveTexture(int texture);
public static void glCompressedTexImage1D(int target, int level, int internalformat, int width, int border, int imageSize, ByteBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage1D(target, level, internalformat, width, border, imageSize, data, data.position());
}
public static void glCompressedTexImage1D(int target, int level, int internalformat, int width, int border, int imageSize, ShortBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage1D(target, level, internalformat, width, border, imageSize, data, data.position() << 1);
}
public static void glCompressedTexImage1D(int target, int level, int internalformat, int width, int border, int imageSize, IntBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage1D(target, level, internalformat, width, border, imageSize, data, data.position() << 2);
}
public static void glCompressedTexImage1D(int target, int level, int internalformat, int width, int border, int imageSize, FloatBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage1D(target, level, internalformat, width, border, imageSize, data, data.position() << 2);
}
private static native void nglCompressedTexImage1D(int target, int level, int internalformat, int width, int border, int imageSize, Buffer data, int data_offset);
public static void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, ByteBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data, data.position());
}
public static void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, ShortBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data, data.position() << 1);
}
public static void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, IntBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data, data.position() << 2);
}
public static void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, FloatBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data, data.position() << 2);
}
private static native void nglCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, Buffer data, int data_offset);
public static void glCompressedTexImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, ByteBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data, data.position());
}
public static void glCompressedTexImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, ShortBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data, data.position() << 1);
}
public static void glCompressedTexImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, IntBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data, data.position() << 2);
}
public static void glCompressedTexImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, FloatBuffer data) {
// TODO: check buffer size valid
nglCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data, data.position() << 2);
}
private static native void nglCompressedTexImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, Buffer data, int data_offset);
public static void glCompressedTexSubImage1D(int target, int level, int xoffset, int width, int format, int imageSize, ByteBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data, data.position());
}
public static void glCompressedTexSubImage1D(int target, int level, int xoffset, int width, int format, int imageSize, ShortBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data, data.position() << 1);
}
public static void glCompressedTexSubImage1D(int target, int level, int xoffset, int width, int format, int imageSize, IntBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data, data.position() << 2);
}
public static void glCompressedTexSubImage1D(int target, int level, int xoffset, int width, int format, int imageSize, FloatBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data, data.position() << 2);
}
private static native void nglCompressedTexSubImage1D(int target, int level, int xoffset, int width, int format, int imageSize, Buffer data, int data_offset);
public static void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, ByteBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data, data.position());
}
public static void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, ShortBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data, data.position() << 1);
}
public static void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, IntBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data, data.position() << 2);
}
public static void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, FloatBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data, data.position() << 2);
}
private static native void nglCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, Buffer data, int data_offset);
public static void glCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int imageSize, ByteBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data, data.position());
}
public static void glCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int imageSize, ShortBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data, data.position() << 1);
}
public static void glCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int imageSize, IntBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data, data.position() << 2);
}
public static void glCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int imageSize, FloatBuffer data) {
// TODO: check buffer size valid
nglCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data, data.position() << 2);
}
private static native void nglCompressedTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int imageSize, Buffer data, int data_offset);
@ -272,16 +247,12 @@ public abstract class GL13 extends GL12 {
public static native void glMultiTexCoord3f(int target, float s, float t, float r);
public static native void glMultiTexCoord4f(int target, float s, float t, float r, float q);
public static void glLoadTransposeMatrix(FloatBuffer m) {
if (m.remaining() < 16) {
throw new BufferUnderflowException();
}
BufferChecks.checkBuffer(m);
nglLoadTransposeMatrixf(m, m.position());
}
private static native void nglLoadTransposeMatrixf(FloatBuffer m, int m_offset);
public static void glMultTransposeMatrix(FloatBuffer m) {
if (m.remaining() < 16) {
throw new BufferUnderflowException();
}
BufferChecks.checkBuffer(m);
nglMultTransposeMatrixf(m, m.position());
}
private static native void nglMultTransposeMatrixf(FloatBuffer m, int m_offset);

View File

@ -88,12 +88,12 @@ public abstract class GL14 extends GL13 {
public static native void glFogCoordf(float coord);
public static void glFogCoordPointer(int stride, FloatBuffer data) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglFogCoordPointer(GL_FLOAT, stride, data, data.position() << 2);
}
private static native void nglFogCoordPointer(int type, int stride, Buffer data, int data_offset);
public static void glFogCoordPointer(int type, int stride, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglFogCoordPointerVBO(type, stride, buffer_offset);
}
private static native void nglFogCoordPointerVBO(int type, int stride, int buffer_offset);
@ -107,7 +107,7 @@ public abstract class GL14 extends GL13 {
/* public static native void glMultiDrawElements(int mode, int piCount, int type, int pIndices, int primcount);*/
public static native void glPointParameterf (int pname, float param);
public static void glPointParameter(int pname, FloatBuffer params) {
// TODO: check buffer size valid
BufferChecks.checkBuffer(params);
nglPointParameterfv(pname, params, params.position());
}
private static native void nglPointParameterfv(int pname, FloatBuffer params, int params_offset);
@ -115,16 +115,16 @@ public abstract class GL14 extends GL13 {
public static native void glSecondaryColor3f (float red, float green, float blue);
public static native void glSecondaryColor3ub (byte red, byte green, byte blue);
public static void glSecondaryColorPointer(int size, boolean unsigned, int stride, ByteBuffer data) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglSecondaryColorPointer(size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, data, data.position());
}
public static void glSecondaryColorPointer(int size, int stride, FloatBuffer data) {
BufferChecks.checkVBOdisabled();
BufferChecks.ensureVBOdisabled();
nglSecondaryColorPointer(size, GL_FLOAT, stride, data, data.position() << 2);
}
private static native void nglSecondaryColorPointer (int size, int type, int stride, Buffer data, int data_offset);
public static void glSecondaryColorPointer(int size, int type, int stride, int buffer_offset) {
BufferChecks.checkVBOenabled();
BufferChecks.ensureVBOenabled();
nglSecondaryColorPointerVBO(size, type, stride, buffer_offset);
}
private static native void nglSecondaryColorPointerVBO(int size, int type, int stride, int buffer_offset);

View File

@ -70,37 +70,45 @@ public class NVEvaluators {
public static final int GL_MAX_RATIONAL_EVAL_ORDER_NV = 0x86D7;
public static void glGetMapControlPointsNV(int target, int index, int type, int ustride, int vstride, boolean packed, FloatBuffer pPoints) {
BufferChecks.checkLargeBuffer(pPoints);
nglGetMapControlPointsNV(target, index, type, ustride, vstride, packed, pPoints, pPoints.position()<<2);
}
private static native void nglGetMapControlPointsNV(int target, int index, int type, int ustride, int vstride, boolean packed, Buffer pPoints, int pPoints_offset);
public static void glMapControlPointsNV(int target, int index, int type, int ustride, int vstride, int uorder, int vorder, boolean packed, FloatBuffer pPoints) {
BufferChecks.checkLargeBuffer(pPoints);
nglMapControlPointsNV(target, index, type, ustride, vstride, uorder, vorder, packed, pPoints, pPoints.position()<<2);
}
private static native void nglMapControlPointsNV(int target, int index, int type, int ustride, int vstride, int uorder, int vorder, boolean packed, Buffer pPoints, int pPoints_offset);
public static void glMapParameterNV(int target, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglMapParameterfvNV(target, pname, pfParams, pfParams.position());
}
private static native void nglMapParameterfvNV(int target, int pname, FloatBuffer pfParams, int pfParams_offset);
public static void glMapParameterNV(int target, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglMapParameterivNV(target, pname, piParams, piParams.position());
}
private static native void nglMapParameterivNV(int target, int pname, IntBuffer piParams, int piParams_offset);
public static void glGetMapParameterNV(int target, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglGetMapParameterfvNV(target, pname, pfParams, pfParams.position());
}
private static native void nglGetMapParameterfvNV(int target, int pname, FloatBuffer pfParams, int pfParams_offset);
public static void glGetMapParameterNV(int target, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetMapParameterivNV(target, pname, piParams, piParams.position());
}
private static native void nglGetMapParameterivNV(int target, int pname, IntBuffer piParams, int piParams_offset);
public static void glGetMapAttribParameterNV(int target, int index, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglGetMapAttribParameterfvNV(target, index, pname, pfParams, pfParams.position());
}
private static native void nglGetMapAttribParameterfvNV(int target, int index, int pname, FloatBuffer pfParams, int pfParams_offset);
public static void glGetMapAttribParameterNV(int target, int index, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetMapAttribParameterivNV(target, index, pname, piParams, piParams.position());
}
private static native void nglGetMapAttribParameterivNV(int target, int index, int pname, IntBuffer piParams, int piParams_offset);

View File

@ -64,6 +64,7 @@ public class NVFence {
public static native boolean glIsFenceNV(int fence);
public static void glGetFenceNV(int fence, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetFenceivNV(fence, pname, piParams, piParams.position());
}
private static native void nglGetFenceivNV(int fence, int pname, IntBuffer piParams, int piParams_offset);

View File

@ -38,7 +38,7 @@
package org.lwjgl.opengl;
public interface NVFloatBuffer {
public class NVFloatBuffer {
/*
* Accepted by the <internalformat> parameter of TexImage2D and

View File

@ -92,9 +92,8 @@ public class NVFragmentProgram extends NVProgram {
public static void glGetProgramNamedParameterNV(int id, ByteBuffer name, FloatBuffer params) {
assert params.remaining() >= 4 : "<params> must have 4 floats available.";
nglGetProgramNamedParameterfvNV(id, name.remaining(), name, name.position(), params, params.position());
BufferChecks.checkBuffer(params);
nglGetProgramNamedParameterfvNV(id, name.remaining(), name, name.position(), params, params.position());
}
@ -114,8 +113,8 @@ public class NVFragmentProgram extends NVProgram {
public static void glGetProgramLocalParameterARB(int target, int index, FloatBuffer params) {
assert params.remaining() >= 4 : "<params> must have 4 floats available.";
BufferChecks.checkBuffer(params);
nglGetProgramLocalParameterfvARB(target, index, params, params.position());
}

View File

@ -38,7 +38,7 @@
package org.lwjgl.opengl;
public interface NVMultisampleFilterHint {
public class NVMultisampleFilterHint {
/*
* Accepted by the <target> parameter of Hint and by the <pname>

View File

@ -65,11 +65,13 @@ public class NVOcclusionQuery {
public static native void glEndOcclusionQueryNV();
public static void glGetOcclusionQueryNV(int id, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetOcclusionQueryivNV(id, pname, piParams, piParams.position());
}
private static native void nglGetOcclusionQueryivNV(int id, int pname, IntBuffer piParams, int piParams_offset);
public static void glGetOcclusionQueryuNV(int id, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetOcclusionQueryuivNV(id, pname, piParams, piParams.position());
}
private static native void nglGetOcclusionQueryuivNV(int id, int pname, IntBuffer piParams, int piParams_offset);

View File

@ -49,6 +49,7 @@ public class NVPointSprite {
public static native void glPointParameteriNV(int pname, int param);
public static void glPointParameterNV(int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglPointParameterivNV(pname, piParams, piParams.position());
}
private static native void nglPointParameterivNV(int pname, IntBuffer piParams, int piParams_offset);

View File

@ -98,6 +98,7 @@ public class NVRegisterCombiners {
public static native void glCombinerParameterfNV(int pname, float param);
public static void glCombinerParameterNV(int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglCombinerParameterfvNV(pname, pfParams, pfParams.position());
}
private static native void nglCombinerParameterfvNV(int pname, FloatBuffer pfParams, int pfParams_offset);
@ -105,6 +106,7 @@ public class NVRegisterCombiners {
public static native void glCombinerParameteriNV(int pname, int param);
public static void glCombinerParameterNV(int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglCombinerParameterivNV(pname, piParams, piParams.position());
}
private static native void nglCombinerParameterivNV(int pname, IntBuffer piParams, int piParams_offset);
@ -132,29 +134,35 @@ public class NVRegisterCombiners {
int mapping,
int componentUsage);
public static void glGetCombinerInputParameterNV(int stage, int portion, int variable, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglGetCombinerInputParameterfvNV(stage, portion, variable, pname, pfParams, pfParams.position());
}
private static native void nglGetCombinerInputParameterfvNV(int stage, int portion, int variable, int pname, FloatBuffer pfParams, int pfParams_offset);
public static void glGetCombinerInputParameterNV(int stage, int portion, int variable, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetCombinerInputParameterivNV(stage, portion, variable, pname, piParams, piParams.position());
}
private static native void nglGetCombinerInputParameterivNV(int stage, int portion, int variable, int pname, IntBuffer piParams, int piParams_offset);
public static void glGetCombinerOutputParameterNV(int stage, int portion, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglGetCombinerOutputParameterfvNV(stage, portion, pname, pfParams, pfParams.position());
}
private static native void nglGetCombinerOutputParameterfvNV(int stage, int portion, int pname, FloatBuffer pfParams, int pfParams_offset);
public static void glGetCombinerOutputParameterNV(int stage, int portion, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetCombinerOutputParameterivNV(stage, portion, pname, piParams, piParams.position());
}
private static native void nglGetCombinerOutputParameterivNV(int stage, int portion, int pname, IntBuffer piParams, int pfParams_offset);
public static void glGetFinalCombinerInputParameterNV(int variable, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglGetFinalCombinerInputParameterfvNV(variable, pname, pfParams, pfParams.position());
}
private static native void nglGetFinalCombinerInputParameterfvNV(int variable, int pname, FloatBuffer pfParams, int pfParams_offset);
public static void glGetFinalCombinerInputParameterNV(int variable, int pname, IntBuffer piParams) {
BufferChecks.checkBuffer(piParams);
nglGetFinalCombinerInputParameterivNV(variable, pname, piParams, piParams.position());
}
private static native void nglGetFinalCombinerInputParameterivNV(int variable, int pname, IntBuffer piParams, int piParams_offset);

View File

@ -46,10 +46,12 @@ public class NVRegisterCombiners2
public static final int GL_PER_STAGE_CONSTANTS_NV = 0x8535;
public static void glCombinerStageParameterNV(int stage, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglCombinerStageParameterfvNV(stage, pname, pfParams, pfParams.position());
}
private static native void nglCombinerStageParameterfvNV(int stage, int pname, FloatBuffer pfParams, int pfParams_offset);
public static void glGetCombinerStageParameterNV(int stage, int pname, FloatBuffer pfParams) {
BufferChecks.checkBuffer(pfParams);
nglGetCombinerStageParameterfvNV(stage, pname, pfParams, pfParams.position());
}
private static native void nglGetCombinerStageParameterfvNV(int stage, int pname, FloatBuffer pfParams, int pfParams_offset);

View File

@ -38,7 +38,7 @@
package org.lwjgl.opengl;
public interface NVTextureExpandNormal {
public class NVTextureExpandNormal {
/*
* Accepted by the <pname> parameters of TexParameteri,

View File

@ -40,6 +40,7 @@
package org.lwjgl.opengl;
import java.nio.Buffer;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
@ -283,9 +284,7 @@ public class NVVertexProgram extends NVProgram {
// ---------------------------
public static void glExecuteProgramNV(int target, int id, FloatBuffer params) {
assert params.remaining() >= 4 : "<params> must have 4 floats available.";
BufferChecks.checkBuffer(params);
nglExecuteProgramNV(target, id, params, params.position());
}
@ -297,10 +296,8 @@ public class NVVertexProgram extends NVProgram {
// ---------------------------
public static void glGetProgramParameterNV(int target, int index, int parameterName, FloatBuffer params) {
assert params.remaining() >= 4 : "<params> must have 4 floats available.";
nglGetProgramParameterfvNV(target, index, parameterName, params, params.position());
BufferChecks.checkBuffer(params);
nglGetProgramParameterfvNV(target, index, parameterName, params, params.position());
}
@ -316,7 +313,7 @@ public class NVVertexProgram extends NVProgram {
// ---------------------------
public static void glGetTrackMatrixNV(int target, int address, int parameterName, IntBuffer params) {
BufferChecks.checkBuffer(params);
nglGetTrackMatrixivNV(target, address, parameterName, params, params.position());
}
@ -333,7 +330,7 @@ public class NVVertexProgram extends NVProgram {
// ---------------------------
public static void glGetVertexAttribNV(int index, int parameterName, FloatBuffer params) {
BufferChecks.checkBuffer(params);
nglGetVertexAttribfvNV(index, parameterName, params, params.position());
}
@ -345,8 +342,8 @@ public class NVVertexProgram extends NVProgram {
// ---------------------------
public static void glGetVertexAttribNV(int index, int parameterName, IntBuffer params) {
nglGetVertexAttribivNV(index, parameterName, params, params.position());
BufferChecks.checkBuffer(params);
nglGetVertexAttribivNV(index, parameterName, params, params.position());
}
@ -362,7 +359,10 @@ public class NVVertexProgram extends NVProgram {
public static void glProgramParameters4NV(int target, int index, int count, FloatBuffer params) {
assert params.remaining() >= 4 * count : "<params> must have " + 4 * count + " floats available.";
// Special case buffer check
if (params.remaining() < count * 4) {
throw new BufferOverflowException();
}
nglProgramParameters4fvNV(target, index, count, params, params.position());
@ -381,7 +381,7 @@ public class NVVertexProgram extends NVProgram {
public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, ByteBuffer buffer) {
assert VBOTracker.getVBOArrayStack().getState() == 0 : "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVertexAttribPointerNV(
index,
@ -395,8 +395,8 @@ public class NVVertexProgram extends NVProgram {
public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, ShortBuffer buffer) {
assert VBOTracker.getVBOArrayStack().getState() == 0 : "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVertexAttribPointerNV(
index,
size,
@ -409,16 +409,16 @@ public class NVVertexProgram extends NVProgram {
public static void glVertexAttribPointerNV(int index, int size, int stride, FloatBuffer buffer) {
assert VBOTracker.getVBOArrayStack().getState() == 0 : "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVertexAttribPointerNV(index, size, GL11.GL_FLOAT, stride, buffer, buffer.position() << 2);
}
public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, IntBuffer buffer) {
assert VBOTracker.getVBOArrayStack().getState() == 0 : "Cannot use Buffers when VBO is enabled";
BufferChecks.ensureVBOdisabled();
nglVertexAttribPointerNV(
index,
size,
@ -441,8 +441,8 @@ public class NVVertexProgram extends NVProgram {
public static void glVertexAttribPointerNV(int index, int size, int type, int stride, int bufferOffset) {
assert VBOTracker.getVBOArrayStack().getState() != 0 : "Cannot use int offsets when VBO is disabled";
BufferChecks.ensureVBOenabled();
nglVertexAttribPointerNVVBO(index, size, type, stride, bufferOffset);
}

View File

@ -42,7 +42,7 @@ import java.nio.*;
abstract class Util {
final static IntBuffer int_buffer = ByteBuffer.allocateDirect(16).order(ByteOrder.nativeOrder()).asIntBuffer();
final static IntBuffer int_buffer = ByteBuffer.allocateDirect(64).order(ByteOrder.nativeOrder()).asIntBuffer();
/**
* A helper function which is used to get the byte offset in an arbitrary buffer

View File

@ -18,7 +18,7 @@ import org.lwjgl.opengl.GL12;
public class Util {
/** temp IntBuffer of one for getting an int from some GL functions */
private static IntBuffer scratch = createIntBuffer(1);
private static IntBuffer scratch = createIntBuffer(256);
/**
* Return ceiling of integer division