diff --git a/src/java/org/lwjgl/Sys.java b/src/java/org/lwjgl/Sys.java index ff974169..20bb2a5f 100644 --- a/src/java/org/lwjgl/Sys.java +++ b/src/java/org/lwjgl/Sys.java @@ -128,25 +128,6 @@ public final class Sys { setTime(0); } - /** - * Create a buffer representing an integer index. Use it with functions that in C can take - * both a pointer and an integer argument, like the ARB_vertex_buffer_object extension specifies - * gl*Pointer to do (among others). - * - * Example: - * - * ByteBuffer b = Sys.createIndexBuffer(0); - * gl.glVertexPointer(3, GL.GL_INT, 0, b); - * - * is equivalent to the C call: - * - * glVertexPointer(3, GL.GL_INT, 0, 0); - * - * @param index The index to represent - * @return a ByteBuffer representing the index - */ - public static native ByteBuffer createIndexBuffer(int index); - /** * Obtains the number of ticks that the hires timer does in a second. * diff --git a/src/java/org/lwjgl/opengl/CoreGL11.java b/src/java/org/lwjgl/opengl/CoreGL11.java index c5b4bdf8..41fb3ca8 100644 --- a/src/java/org/lwjgl/opengl/CoreGL11.java +++ b/src/java/org/lwjgl/opengl/CoreGL11.java @@ -87,12 +87,19 @@ public abstract class CoreGL11 implements CoreGL11Constants { public static native void glCopyTexImage1D(int target, int level, int internalFormat, int x, int y, int width, int border); 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) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglColorPointer(size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, pointer, pointer.position()); } public static void glColorPointer(int size, int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglColorPointerVBO(size, type, stride, buffer_offset); + } + private static native void nglColorPointerVBO(int size, int type, int stride, int buffer_offset); public static native void glColorMaterial(int face, int mode); public static native void glColorMask(boolean red, boolean green, boolean blue, boolean alpha); public static native void glColor3b(byte red, byte green, byte blue); @@ -118,9 +125,15 @@ public abstract class CoreGL11 implements CoreGL11Constants { public static native void glEnable(int cap); public static native void glDisable(int cap); public static void glEdgeFlagPointer(int stride, ByteBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + 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) { nglDrawPixels(width, height, format, type, pixels, pixels.position()); @@ -133,15 +146,23 @@ public abstract class CoreGL11 implements CoreGL11Constants { } 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) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_BYTE, indices, indices.position()); } public static void glDrawElements(int mode, ShortBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawElements(mode, indices.remaining(), GL_UNSIGNED_SHORT, indices, indices.position() << 1); } public static void glDrawElements(int mode, IntBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOElementStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglDrawElementsVBO(mode, count, type, buffer_offset); + } + private static native void nglDrawElementsVBO(int mode, int count, int type, int buffer_offset); public static native void glDrawBuffer(int mode); public static native void glDrawArrays(int mode, int first, int count); public static native void glDepthRange(double zNear, double zFar); @@ -237,18 +258,27 @@ public abstract class CoreGL11 implements CoreGL11Constants { 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) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglInterleavedArrays(format, stride, pointer, pointer.position()); } public static void glInterleavedArrays(int format, int stride, ShortBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglInterleavedArrays(format, stride, pointer, pointer.position() << 1); } public static void glInterleavedArrays(int format, int stride, IntBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglInterleavedArrays(format, stride, pointer, pointer.position() << 2); } public static void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + 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) { @@ -377,15 +407,23 @@ public abstract class CoreGL11 implements CoreGL11Constants { 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) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglNormalPointer(GL_BYTE, stride, pointer, pointer.position()); } public static void glNormalPointer(int stride, IntBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglNormalPointer(GL_INT, stride, pointer, pointer.position() << 2); } public static void glNormalPointer(int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglNormalPointerVBO(type, stride, buffer_offset); + } + private static native void nglNormalPointerVBO(int type, int stride, int buffer_offset); public static native void glNormal3b(byte nx, byte ny, byte nz); public static native void glNormal3f(float nx, float ny, float nz); public static native void glNormal3i(int nx, int ny, int nz); @@ -427,18 +465,41 @@ public abstract class CoreGL11 implements CoreGL11Constants { public static native void glPopName(); public static native void glPushMatrix(); public static native void glPopMatrix(); - public static native void glPushClientAttrib(int mask); - public static native void glPopClientAttrib(); + public static void glPushClientAttrib(int mask) { + VBOTracker.getClientAttribStack().pushState(); + VBOTracker.getClientAttribStack().setState(mask); + if ((mask & GL_CLIENT_VERTEX_ARRAY_BIT) != 0) { + VBOTracker.getVBOArrayStack().pushState(); + VBOTracker.getVBOElementStack().pushState(); + } + nglPushClientAttrib(mask); + } + private static native void nglPushClientAttrib(int mask); + public static void glPopClientAttrib() { + if ((VBOTracker.getClientAttribStack().popState() & GL_CLIENT_VERTEX_ARRAY_BIT) != 0) { + VBOTracker.getVBOArrayStack().popState(); + VBOTracker.getVBOElementStack().popState(); + } + nglPopClientAttrib(); + } + private static native void nglPopClientAttrib(); public static native void glPushAttrib(int mask); 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) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexPointer(size, GL_FLOAT, stride, pointer, pointer.position() << 2); } public static void glVertexPointer(int size, int stride, IntBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglVertexPointerVBO(size, type, stride, buffer_offset); + } + private static native void nglVertexPointerVBO(int size, int type, int stride, int buffer_offset); public static native void glVertex2f(float x, float y); public static native void glVertex2i(int x, int y); public static native void glVertex3f(float x, float y, float z); @@ -509,9 +570,15 @@ public abstract class CoreGL11 implements CoreGL11Constants { } private static native void nglTexEnviv(int target, int pname, IntBuffer params, int params_offset); public static void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglTexCoordPointerVBO(size, type, stride, buffer_offset); + } + private static native void nglTexCoordPointerVBO(int size, int type, int stride, int buffer_offset); public static native void glTexCoord1f(float s); public static native void glTexCoord2f(float s, float t); public static native void glTexCoord3f(float s, float t, float r); diff --git a/src/java/org/lwjgl/opengl/CoreGL12.java b/src/java/org/lwjgl/opengl/CoreGL12.java index fee68ad3..cc5185d4 100644 --- a/src/java/org/lwjgl/opengl/CoreGL12.java +++ b/src/java/org/lwjgl/opengl/CoreGL12.java @@ -191,15 +191,23 @@ public abstract class CoreGL12 extends CoreGL11 implements CoreGL12Constants { } 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) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglDrawRangeElements(mode, start, end, indices.remaining(), GL_UNSIGNED_BYTE, indices, indices.position()); } public static void glDrawRangeElements(int mode, int start, int end, ShortBuffer indices) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOElementStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOElementStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + 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) { nglTexImage3D(target, level, internalFormat, width, height, depth, border, format, type, pixels, pixels.position()); } diff --git a/src/java/org/lwjgl/opengl/CoreGL14.java b/src/java/org/lwjgl/opengl/CoreGL14.java index 9b0cbb13..e319e8c7 100644 --- a/src/java/org/lwjgl/opengl/CoreGL14.java +++ b/src/java/org/lwjgl/opengl/CoreGL14.java @@ -46,11 +46,17 @@ import java.nio.Buffer; * @version $Revision: 1.23 $ */ public abstract class CoreGL14 extends CoreGL13 implements CoreGL14Constants { - public static native void glFogCoordf (float coord); - public static void glFogCoordPointer (int stride, FloatBuffer data) { + public static native void glFogCoordf(float coord); + public static void glFogCoordPointer(int stride, FloatBuffer data) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglFogCoordPointer(GL_FLOAT, stride, data, data.position() << 2); } - private static native void nglFogCoordPointer (int type, int stride, Buffer data, int data_offset); + 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) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglFogCoordPointerVBO(type, stride, buffer_offset); + } + private static native void nglFogCoordPointerVBO(int type, int stride, int buffer_offset); public static void glMultiDrawArrays(int mode, IntBuffer piFirst, IntBuffer piCount) { assert piFirst.remaining() == piCount.remaining(): "piFirst.remaining() != piCount.remaining()"; nglMultiDrawArrays(mode, piFirst, piFirst.position(), piCount, piCount.position(), piFirst.remaining()); @@ -65,13 +71,20 @@ public abstract class CoreGL14 extends CoreGL13 implements CoreGL14Constants { public static native void glSecondaryColor3b (byte red, byte green, byte blue); 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) { + public static void glSecondaryColorPointer(int size, boolean unsigned, int stride, ByteBuffer data) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglSecondaryColorPointer(size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, data, data.position()); } - public static void glSecondaryColorPointer (int size, int stride, FloatBuffer data) { + public static void glSecondaryColorPointer(int size, int stride, FloatBuffer data) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; 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) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglSecondaryColorPointerVBO(size, type, stride, buffer_offset); + } + private static native void nglSecondaryColorPointerVBO(int size, int type, int stride, int buffer_offset); public static native void glBlendFuncSeparate (int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha); public static native void glWindowPos2f (float x, float y); public static native void glWindowPos2i (int x, int y); diff --git a/src/java/org/lwjgl/opengl/GL.java b/src/java/org/lwjgl/opengl/GL.java index edd02158..c4c7940d 100644 --- a/src/java/org/lwjgl/opengl/GL.java +++ b/src/java/org/lwjgl/opengl/GL.java @@ -1149,19 +1149,27 @@ public abstract class GL extends CoreGL14 implements GLConstants { private static native void nglVertexAttrib4usvARB(int index, ShortBuffer psV, int psV_offset); public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, ByteBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexAttribPointerARB(index, size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, normalized, stride, pPointer, pPointer.position()); } public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, ShortBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexAttribPointerARB(index, size, unsigned ? GL_UNSIGNED_SHORT : GL_SHORT, normalized, stride, pPointer, pPointer.position()<<1); } public static void glVertexAttribPointerARB(int index, int size, boolean normalized, int stride, FloatBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexAttribPointerARB(index, size, GL_FLOAT, normalized, stride, pPointer, pPointer.position()<<2); } public static void glVertexAttribPointerARB(int index, int size, boolean unsigned, boolean normalized, int stride, IntBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglVertexAttribPointerARB(index, size, unsigned ? GL_UNSIGNED_INT : GL_INT, normalized, stride, pPointer, pPointer.position()<<2); } private static native void nglVertexAttribPointerARB(int index, int size, int type, boolean normalized, int stride, Buffer pPointer, int pPointer_offset); - + public static void glVertexAttribPointerARB(int index, int size, int type, boolean normalized, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglVertexAttribPointerARBVBO(index, size, type, normalized, stride, buffer_offset); + } + private static native void nglVertexAttribPointerARBVBO(int index, int size, int type, boolean normalized, int stride, int buffer_offset); public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, ByteBuffer pPointer) { nglVertexAttribPointerNV(index, size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, pPointer, pPointer.position()); } @@ -1283,18 +1291,27 @@ public abstract class GL extends CoreGL14 implements GLConstants { private static native void nglWeightivARB(int size, IntBuffer piWeights, int piWeights_offset); public static void glWeightPointerARB(int size, boolean unsigned, int stride, ByteBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglWeightPointerARB(size, unsigned ? GL_UNSIGNED_BYTE : GL_BYTE, stride, pPointer, pPointer.position()); } public static void glWeightPointerARB(int size, boolean unsigned, int stride, ShortBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglWeightPointerARB(size, unsigned ? GL_UNSIGNED_SHORT : GL_SHORT, stride, pPointer, pPointer.position()<<1); } public static void glWeightPointerARB(int size, int stride, FloatBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglWeightPointerARB(size, GL_FLOAT, stride, pPointer, pPointer.position()<<2); } public static void glWeightPointerARB(int size, boolean unsigned, int stride, IntBuffer pPointer) { + assert VBOTracker.getVBOArrayStack().getState() == 0: "Cannot use Buffers when VBO is enabled"; nglWeightPointerARB(size, unsigned ? GL_UNSIGNED_INT : GL_INT, stride, pPointer, pPointer.position()<<2); } private static native void nglWeightPointerARB(int size, int type, int stride, Buffer pPointer, int pPointer_offset); + public static void glWeightPointerARB(int size, int type, int stride, int buffer_offset) { + assert VBOTracker.getVBOArrayStack().getState() != 0: "Cannot use int offsets when VBO is disabled"; + nglWeightPointerARBVBO(size, type, stride, buffer_offset); + } + private static native void nglWeightPointerARBVBO(int size, int type, int stride, int buffer_offset); public static void glWeightARB(ShortBuffer psWeights) { nglWeightsvARB(psWeights.remaining(), psWeights, psWeights.position()); @@ -1444,8 +1461,27 @@ public abstract class GL extends CoreGL14 implements GLConstants { int outZ, int outW); - public static native void glBindBufferARB(int target, int buffer); + public static void glBindBufferARB(int target, int buffer) { + switch (target) { + case GL_ELEMENT_ARRAY_BUFFER_ARB: + VBOTracker.getVBOElementStack().setState(buffer); + break; + case GL_ARRAY_BUFFER_ARB: + VBOTracker.getVBOArrayStack().setState(buffer); + break; + default: assert false: "Unsupported VBO target " + target; + } + nglBindBufferARB(target, buffer); + } + private static native void nglBindBufferARB(int target, int buffer); public static void glDeleteBuffersARB(IntBuffer buffers) { + for (int i = buffers.position(); i < buffers.limit(); i++) { + int buffer_handle = buffers.get(i); + if (VBOTracker.getVBOElementStack().getState() == buffer_handle) + VBOTracker.getVBOElementStack().setState(0); + if (VBOTracker.getVBOArrayStack().getState() == buffer_handle) + VBOTracker.getVBOArrayStack().setState(0); + } nglDeleteBuffersARB(buffers.remaining(), buffers, buffers.position()); } private static native void nglDeleteBuffersARB(int n, IntBuffer buffers, int buffers_offset); diff --git a/src/java/org/lwjgl/opengl/Pbuffer.java b/src/java/org/lwjgl/opengl/Pbuffer.java index 53315341..faa8b19a 100644 --- a/src/java/org/lwjgl/opengl/Pbuffer.java +++ b/src/java/org/lwjgl/opengl/Pbuffer.java @@ -50,16 +50,19 @@ import org.lwjgl.*; public class Pbuffer { public final static int PBUFFER_SUPPORTED = 1; + /** Current Pbuffer */ + private static Pbuffer currentBuffer = null; + + /** Handle to the native GL rendering context */ + private final int handle; + + /** Tracks VBO state */ + private final VBOTracker vbo_tracker; + static { System.loadLibrary(Sys.getLibraryName()); } - /** Handle to the native GL rendering context */ - protected final int handle; - - /** Current Pbuffer */ - private static Pbuffer currentBuffer = null; - /** * Construct an instance of a Pbuffer. If this fails then an Exception will be thrown. * The buffer is single-buffered. @@ -81,6 +84,7 @@ public class Pbuffer { */ public Pbuffer(int width, int height, int bpp, int alpha, int depth, int stencil) throws Exception { handle = nCreate(width, height, bpp, alpha, depth, stencil); + vbo_tracker = new VBOTracker(); } /** @@ -88,6 +92,7 @@ public class Pbuffer { */ public static void releaseContext() { currentBuffer = null; + VBOTracker.releaseCurrent(); nReleaseContext(); } @@ -119,6 +124,7 @@ public class Pbuffer { */ public void makeCurrent() { currentBuffer = this; + VBOTracker.setCurrent(vbo_tracker); nMakeCurrent(handle); } @@ -150,7 +156,8 @@ public class Pbuffer { * Destroys the Pbuffer. The buffer must not be current. */ public void destroy() { - assert currentBuffer != this : "Pbuffers must not be current when releasing it"; + if (currentBuffer == this) + releaseContext(); nDestroy(handle); } diff --git a/src/java/org/lwjgl/opengl/StateStack.java b/src/java/org/lwjgl/opengl/StateStack.java new file mode 100644 index 00000000..8904a88f --- /dev/null +++ b/src/java/org/lwjgl/opengl/StateStack.java @@ -0,0 +1,64 @@ +/* + * 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: + * + * * 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. + */ + +package org.lwjgl.opengl; + +public class StateStack { + /** Only int state is tracked */ + private final int[] state_stack; + private int stack_pos; + + public int getState() { + return state_stack[stack_pos]; + } + + public void setState(int new_state) { + state_stack[stack_pos] = new_state; + } + + public void pushState() { + stack_pos++; + state_stack[stack_pos] = state_stack[stack_pos - 1]; + } + + public int popState() { + int result = state_stack[stack_pos]; + stack_pos--; + return result; + } + + public StateStack(int stack_size, int initial_value) { + state_stack = new int[stack_size]; + stack_pos = 0; + state_stack[stack_pos] = initial_value; + } +} diff --git a/src/java/org/lwjgl/opengl/Util.java b/src/java/org/lwjgl/opengl/Util.java index 0d393595..cb08e4a6 100644 --- a/src/java/org/lwjgl/opengl/Util.java +++ b/src/java/org/lwjgl/opengl/Util.java @@ -40,6 +40,7 @@ import java.nio.*; * @version $Revision$ */ abstract class Util { + private final static IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); /** * A helper function which is used to get the byte offset in an arbitrary buffer * based on its position @@ -55,4 +56,9 @@ abstract class Util { else return buffer.position(); } + + static int getGLInteger(int enum) { + CoreGL11.glGetInteger(enum, int_buffer); + return int_buffer.get(0); + } } diff --git a/src/java/org/lwjgl/opengl/VBOTracker.java b/src/java/org/lwjgl/opengl/VBOTracker.java new file mode 100644 index 00000000..1da5a527 --- /dev/null +++ b/src/java/org/lwjgl/opengl/VBOTracker.java @@ -0,0 +1,69 @@ +/* + * 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: + * + * * 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. + */ + +package org.lwjgl.opengl; + +public class VBOTracker { + private static VBOTracker default_tracker = new VBOTracker(); + private static VBOTracker current_tracker = default_tracker; + + private final StateStack vbo_array_stack; + private final StateStack vbo_element_stack; + private final StateStack attrib_stack; + + public static void setCurrent(VBOTracker tracker) { + current_tracker = tracker; + } + + public static void releaseCurrent() { + current_tracker = default_tracker; + } + + public VBOTracker() { + int stack_size = Util.getGLInteger(CoreGL11Constants.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH); + vbo_array_stack = new StateStack(stack_size, 0); + vbo_element_stack = new StateStack(stack_size, 0); + attrib_stack = new StateStack(stack_size, 0); + } + + public static StateStack getVBOArrayStack() { + return current_tracker.vbo_array_stack; + } + + public static StateStack getVBOElementStack() { + return current_tracker.vbo_element_stack; + } + + public static StateStack getClientAttribStack() { + return current_tracker.attrib_stack; + } +} diff --git a/src/java/org/lwjgl/opengl/Window.java b/src/java/org/lwjgl/opengl/Window.java index 83660b84..918a411d 100644 --- a/src/java/org/lwjgl/opengl/Window.java +++ b/src/java/org/lwjgl/opengl/Window.java @@ -66,6 +66,9 @@ public final class Window { /** Fullscreen */ private static boolean fullscreen; + /** Tracks VBO state for the window context */ + private static VBOTracker vbo_tracker; + /** * Construct a Window. Some OSs may not support non-fullscreen windows; in * which case the window will be fullscreen regardless. @@ -232,8 +235,7 @@ public final class Window { Window.title = title; Window.width = Display.getWidth(); Window.height = Display.getHeight(); - nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil); - created = true; + createWindow(); } /** @@ -268,8 +270,7 @@ public final class Window { Window.stencil = stencil; Window.fullscreen = false; Window.title = title; - nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil); - created = true; + createWindow(); } /** @@ -289,6 +290,11 @@ public final class Window { int stencil) throws Exception; + private static void createWindow() throws Exception { + nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil); + created = true; + } + /** * Destroy the window. */ diff --git a/src/java/org/lwjgl/test/opengl/VBOIndexTest.java b/src/java/org/lwjgl/test/opengl/VBOIndexTest.java new file mode 100644 index 00000000..5988def9 --- /dev/null +++ b/src/java/org/lwjgl/test/opengl/VBOIndexTest.java @@ -0,0 +1,242 @@ +/* + * 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: + * + * * 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. + */ + +/** + * $Id$ + * + * Simple java test program. + * + * @author elias_naur + * @version $Revision$ + */ + +package org.lwjgl.test.opengl; + +import org.lwjgl.*; +import org.lwjgl.opengl.*; +import org.lwjgl.input.*; + +import java.nio.*; + +public final class VBOIndexTest { + static { + try { + //find first display mode that allows us 640*480*16 + int mode = -1; + DisplayMode[] modes = Display.getAvailableDisplayModes(); + for (int i = 0; i < modes.length; i++) { + if (modes[i].width == 640 + && modes[i].height == 480 + && modes[i].bpp >= 16) { + mode = i; + break; + } + } + if (mode != -1) { + //select above found displaymode + System.out.println("Setting display mode to "+modes[mode]); + Display.setDisplayMode(modes[mode]); + System.out.println("Created display."); + } + } catch (Exception e) { + System.err.println("Failed to create display due to " + e); + } + } + + static { + try { + Window.create("LWJGL Game Example", 16, 0, 0,0); + System.out.println("Created OpenGL."); + } catch (Exception e) { + System.err.println("Failed to create OpenGL due to "+e); + System.exit(1); + } + } + + /** Is the game finished? */ + private static boolean finished; + + /** A rotating square! */ + private static float angle; + private static int buffer_id; + private static int indices_buffer_id; + private static FloatBuffer vertices; + private static ByteBuffer mapped_buffer = null; + private static FloatBuffer mapped_float_buffer = null; + private static IntBuffer indices; + private static ByteBuffer mapped_indices_buffer = null; + private static IntBuffer mapped_indices_int_buffer = null; + + public static void main(String[] arguments) { + try { + init(); + while (!finished) { + Window.tick(); + + if (Window.isMinimized()) + Thread.sleep(200); + else if (Window.isCloseRequested()) + System.exit(0); + + Keyboard.poll(); + mainLoop(); + render(); + Window.paint(); + } + } catch (Throwable t) { + t.printStackTrace(); + } finally { + cleanup(); + } + } + + /** + * All calculations are done in here + */ + private static void mainLoop() { + angle += 1f; + if (angle > 360.0f) + angle = 0.0f; + + Mouse.poll(); + if (Mouse.dx != 0 || Mouse.dy != 0 || Mouse.dwheel != 0) + System.out.println("Mouse moved " + Mouse.dx + " " + Mouse.dy + " " + Mouse.dwheel); + for (int i = 0; i < Mouse.buttonCount; i++) + if (Mouse.isButtonDown(i)) + System.out.println("Button " + i + " down"); +/* Keyboard.poll(); + if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) + finished = true;*/ + Keyboard.read(); + for (int i = 0; i < Keyboard.getNumKeyboardEvents(); i++) { + Keyboard.next(); + if (Keyboard.key == Keyboard.KEY_ESCAPE && Keyboard.state) + finished = true; + if (Keyboard.key == Keyboard.KEY_T && Keyboard.state) + System.out.println("Current time: " + Sys.getTime()); + } + } + + /** + * All rendering is done in here + */ + private static void render() { + GL.glClear(GL.GL_COLOR_BUFFER_BIT); + GL.glPushMatrix(); + GL.glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f); + GL.glRotatef(angle, 0, 0, 1.0f); + + + ByteBuffer new_mapped_buffer = GL.glMapBufferARB(GL.GL_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY_ARB, 2*4*4, mapped_buffer); + if (new_mapped_buffer != mapped_buffer) + mapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer(); + mapped_buffer = new_mapped_buffer; + + new_mapped_buffer = GL.glMapBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY_ARB, 4*4, mapped_indices_buffer); + if (new_mapped_buffer != mapped_indices_buffer) + mapped_indices_int_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer(); + + mapped_float_buffer.rewind(); + vertices.rewind(); + mapped_float_buffer.put(vertices); + + mapped_indices_int_buffer.rewind(); + indices.rewind(); + mapped_indices_int_buffer.put(indices); + if (GL.glUnmapBufferARB(GL.GL_ARRAY_BUFFER_ARB) && GL.glUnmapBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB)) { + GL.glDrawElements(GL.GL_QUADS, 4, GL.GL_UNSIGNED_INT, 0); + } + GL.glPopMatrix(); + } + + /** + * Initialize + */ + private static void init() throws Exception { + Keyboard.create(); + Keyboard.enableBuffer(); + Mouse.create(); + Sys.setTime(0); + Sys.setProcessPriority(Sys.HIGH_PRIORITY); + System.out.println("Timer resolution: " + Sys.getTimerResolution()); + // Go into orthographic projection mode. + GLCaps.determineAvailableExtensions(); + GL.glMatrixMode(GL.GL_PROJECTION); + GL.glLoadIdentity(); + GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight()); + GL.glMatrixMode(GL.GL_MODELVIEW); + GL.glLoadIdentity(); + GL.glViewport(0, 0, Display.getWidth(), Display.getHeight()); + if (!GLCaps.GL_ARB_vertex_buffer_object) { + System.out.println("ARB VBO not supported!"); + System.exit(1); + } + IntBuffer int_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer(); + GL.glGenBuffersARB(int_buffer); + buffer_id = int_buffer.get(0); + indices_buffer_id = int_buffer.get(1); + GL.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, buffer_id); + GL.glBindBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, indices_buffer_id); + vertices = ByteBuffer.allocateDirect(2*4*4).order(ByteOrder.nativeOrder()).asFloatBuffer(); + vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50); + vertices.rewind(); + indices = ByteBuffer.allocateDirect(4*4).order(ByteOrder.nativeOrder()).asIntBuffer(); + indices.put(0).put(1).put(2).put(3); + indices.rewind(); + GL.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, 2*4*4, (ByteBuffer)null, GL.GL_STREAM_DRAW_ARB); + GL.glBufferDataARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, 4*4, (ByteBuffer)null, GL.GL_STREAM_DRAW_ARB); + GL.glEnableClientState(GL.GL_VERTEX_ARRAY); + GL.glVertexPointer(2, GL.GL_FLOAT, 0, 0); + GL.glGetInteger(GL.GL_MAX_TEXTURE_UNITS_ARB, int_buffer); + System.out.println("Number of texture units: " + int_buffer.get(0)); + // Fix the refresh rate to the display frequency. +// gl.wglSwapIntervalEXT(1); + } + + /** + * Cleanup + */ + private static void cleanup() { + IntBuffer int_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer(); + int_buffer.put(0, buffer_id); + int_buffer.put(1, indices_buffer_id); + GL.glDeleteBuffersARB(int_buffer); + Keyboard.destroy(); + Mouse.destroy(); + Window.destroy(); + try { + Display.resetDisplayMode(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } diff --git a/src/java/org/lwjgl/test/opengl/VBOTest.java b/src/java/org/lwjgl/test/opengl/VBOTest.java index 322b210f..d7eceaf6 100644 --- a/src/java/org/lwjgl/test/opengl/VBOTest.java +++ b/src/java/org/lwjgl/test/opengl/VBOTest.java @@ -191,9 +191,8 @@ public final class VBOTest { vertices = ByteBuffer.allocateDirect(2*4*4).order(ByteOrder.nativeOrder()).asFloatBuffer(); vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50); GL.glBufferDataARB(GL.GL_ARRAY_BUFFER_ARB, 2*4*4, (ByteBuffer)null, GL.GL_STREAM_DRAW_ARB); - ByteBuffer index_buffer = Sys.createIndexBuffer(0); GL.glEnableClientState(GL.GL_VERTEX_ARRAY); - GL.glVertexPointer(2, 0, index_buffer.asFloatBuffer()); + GL.glVertexPointer(2, GL.GL_FLOAT, 0, 0); GL.glGetInteger(GL.GL_MAX_TEXTURE_UNITS_ARB, int_buffer); System.out.println("Number of texture units: " + int_buffer.get(0)); // Fix the refresh rate to the display frequency. diff --git a/src/native/common/extgl.h b/src/native/common/extgl.h index 98eab4ed..5e88007e 100644 --- a/src/native/common/extgl.h +++ b/src/native/common/extgl.h @@ -2625,7 +2625,7 @@ typedef void (APIENTRY * glSecondaryColor3uiPROC) (GLuint red, GLuint green, GLu typedef void (APIENTRY * glSecondaryColor3uivPROC) (const GLuint *v); typedef void (APIENTRY * glSecondaryColor3usPROC) (GLushort red, GLushort green, GLushort blue); typedef void (APIENTRY * glSecondaryColor3usvPROC) (const GLushort *v); -typedef void (APIENTRY * glSecondaryColorPointerPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +typedef void (APIENTRY * glSecondaryColorPointerPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRY * glBlendFuncSeparatePROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); typedef void (APIENTRY * glWindowPos2dPROC) (GLdouble x, GLdouble y); typedef void (APIENTRY * glWindowPos2fPROC) (GLfloat x, GLfloat y); @@ -4078,7 +4078,7 @@ typedef void (APIENTRY * glWeightdvARBPROC) (GLint size, GLdouble *weights); typedef void (APIENTRY * glWeightubvARBPROC) (GLint size, GLubyte *weights); typedef void (APIENTRY * glWeightusvARBPROC) (GLint size, GLushort *weights); typedef void (APIENTRY * glWeightuivARBPROC) (GLint size, GLuint *weights); -typedef void (APIENTRY * glWeightPointerARBPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); +typedef void (APIENTRY * glWeightPointerARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRY * glVertexBlendARBPROC) (GLint count); extern glWeightbvARBPROC glWeightbvARB; diff --git a/src/native/common/org_lwjgl_Sys.h b/src/native/common/org_lwjgl_Sys.h index 7d4a39fd..92b30e5b 100644 --- a/src/native/common/org_lwjgl_Sys.h +++ b/src/native/common/org_lwjgl_Sys.h @@ -20,14 +20,6 @@ extern "C" { /* Inaccessible static: DEBUG */ /* Inaccessible static: _debug */ /* Inaccessible static: class_00024org_00024lwjgl_00024Sys */ -/* - * Class: org_lwjgl_Sys - * Method: createIndexBuffer - * Signature: (I)Ljava/nio/ByteBuffer; - */ -JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_createIndexBuffer - (JNIEnv *, jclass, jint); - /* * Class: org_lwjgl_Sys * Method: getTimerResolution diff --git a/src/native/common/org_lwjgl_opengl_CoreGL11.cpp b/src/native/common/org_lwjgl_opengl_CoreGL11.cpp index ed04824f..b018566c 100644 --- a/src/native/common/org_lwjgl_opengl_CoreGL11.cpp +++ b/src/native/common/org_lwjgl_opengl_CoreGL11.cpp @@ -54,6 +54,10 @@ static inline jobject newBuffer(JNIEnv *env, void *p, int size) { return env->NewDirectByteBuffer(p, size); } +static inline const void *offsetToPointer(jint offset) { + return (const char *)NULL + offset; +} + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glAccum @@ -277,7 +281,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glCopyPixels(JNIEnv * env, /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glColorPointer + * Method: nglColorPointer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglColorPointer(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jobject buffer, jint buffer_offset) { @@ -286,6 +290,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglColorPointer(JNIEnv * e CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglColorPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglColorPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + glColorPointer((GLint) p0, (GLint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glColorMaterial @@ -493,15 +507,25 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glDisable(JNIEnv * env, jc /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glEdgeFlagPointer + * Method: nglEdgeFlagPointer */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointer(JNIEnv * env, jclass clazz, jint p0, jobject buffer, int offset) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointer(JNIEnv * env, jclass clazz, jint p0, jobject buffer, jint offset) { const GLbyte *address = offset + (const GLbyte *)env->GetDirectBufferAddress(buffer); glEdgeFlagPointer((GLint) p0, (const void *)address); CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglEdgeFlagPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint buffer_offset) +{ + glEdgeFlagPointer((GLint) p0, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glEdgeFlag @@ -524,7 +548,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawPixels(JNIEnv * env /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glDrawElements + * Method: nglDrawElements */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawElements(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jobject buffer, jint offset) { @@ -533,6 +557,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawElements(JNIEnv * e CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglDrawElementsVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawElementsVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + glDrawElements((GLint) p0, (GLint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glDrawBuffer @@ -888,7 +922,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_CoreGL11_glIsEnabled(JNIEnv * e /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glInterleavedArrays + * Method: nglInterleavedArrays */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglInterleavedArrays(JNIEnv * env, jclass clazz, jint p0, jint p1, jobject buffer, jint offset) { @@ -897,6 +931,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglInterleavedArrays(JNIEn CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglInterleavedArraysVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglInterleavedArraysVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint buffer_offset) +{ + glInterleavedArrays((GLint) p0, (GLint) p1, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glInitNames @@ -1452,7 +1496,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glOrtho(JNIEnv * env, jcla /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glNormalPointer + * Method: nglNormalPointer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglNormalPointer(JNIEnv * env, jclass clazz, jint p0, jint p1, jobject buffer, jint offset) { @@ -1461,6 +1505,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglNormalPointer(JNIEnv * CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglNormalPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglNormalPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint buffer_offset) +{ + glNormalPointer((GLint) p0, (GLint) p1, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glNormal3b @@ -1735,9 +1789,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPopMatrix(JNIEnv * env, /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glPushClientAttrib + * Method: nglPushClientAttrib */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPushClientAttrib(JNIEnv * env, jclass clazz, jint p0) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglPushClientAttrib(JNIEnv * env, jclass clazz, jint p0) { glPushClientAttrib((GLint) p0); CHECK_GL_ERROR @@ -1745,9 +1799,9 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPushClientAttrib(JNIEnv /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glPopClientAttrib + * Method: nglPopClientAttrib */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPopClientAttrib(JNIEnv * env, jclass clazz) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglPopClientAttrib(JNIEnv * env, jclass clazz) { glPopClientAttrib(); CHECK_GL_ERROR @@ -1785,7 +1839,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glStencilFunc(JNIEnv * env /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glVertexPointer + * Method: nglVertexPointer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglVertexPointer(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jobject buffer, jint offset) { @@ -1794,6 +1848,15 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglVertexPointer(JNIEnv * CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglVertexPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglVertexPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + glVertexPointer((GLint) p0, (GLint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} /* * Class: org_lwjgl_opengl_CoreGL11 @@ -2017,7 +2080,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexEnviv(JNIEnv * env, /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glTexCoordPointer + * Method: nglTexCoordPointer */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointer(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jobject buffer, jint offset) { @@ -2026,6 +2089,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointer(JNIEnv CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglTexCoordPointerVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointerVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + glTexCoordPointer((GLint) p0, (GLint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glTexCoord1f diff --git a/src/native/common/org_lwjgl_opengl_CoreGL11.h b/src/native/common/org_lwjgl_opengl_CoreGL11.h index 64f05b71..2cceaf71 100644 --- a/src/native/common/org_lwjgl_opengl_CoreGL11.h +++ b/src/native/common/org_lwjgl_opengl_CoreGL11.h @@ -7,6 +7,8 @@ #ifdef __cplusplus extern "C" { #endif +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL11 */ /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glAccum @@ -191,6 +193,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glCopyPixels JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglColorPointer (JNIEnv *, jclass, jint, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglColorPointerVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglColorPointerVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glColorMaterial @@ -367,6 +377,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glDisable JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointer (JNIEnv *, jclass, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglEdgeFlagPointerVBO + * Signature: (II)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglEdgeFlagPointerVBO + (JNIEnv *, jclass, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glEdgeFlag @@ -391,6 +409,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawPixels JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawElements (JNIEnv *, jclass, jint, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglDrawElementsVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglDrawElementsVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glDrawBuffer @@ -663,6 +689,14 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_CoreGL11_glIsEnabled JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglInterleavedArrays (JNIEnv *, jclass, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglInterleavedArraysVBO + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglInterleavedArraysVBO + (JNIEnv *, jclass, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glInitNames @@ -1087,6 +1121,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glOrtho JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglNormalPointer (JNIEnv *, jclass, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglNormalPointerVBO + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglNormalPointerVBO + (JNIEnv *, jclass, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glNormal3b @@ -1297,18 +1339,18 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPopMatrix /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glPushClientAttrib + * Method: nglPushClientAttrib * Signature: (I)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPushClientAttrib +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglPushClientAttrib (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_opengl_CoreGL11 - * Method: glPopClientAttrib + * Method: nglPopClientAttrib * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glPopClientAttrib +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglPopClientAttrib (JNIEnv *, jclass); /* @@ -1343,6 +1385,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_glStencilFunc JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglVertexPointer (JNIEnv *, jclass, jint, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglVertexPointerVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglVertexPointerVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glVertex2f @@ -1519,6 +1569,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexEnviv JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointer (JNIEnv *, jclass, jint, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL11 + * Method: nglTexCoordPointerVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL11_nglTexCoordPointerVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL11 * Method: glTexCoord1f diff --git a/src/native/common/org_lwjgl_opengl_CoreGL12.cpp b/src/native/common/org_lwjgl_opengl_CoreGL12.cpp index bafc867a..6341f232 100644 --- a/src/native/common/org_lwjgl_opengl_CoreGL12.cpp +++ b/src/native/common/org_lwjgl_opengl_CoreGL12.cpp @@ -47,6 +47,10 @@ #include "checkGLerror.h" #include "extgl.h" +static inline const void *offsetToPointer(jint offset) { + return (const char *)NULL + offset; +} + /* * Class: org_lwjgl_opengl_CoreGL12 * Method: glColorTable @@ -518,7 +522,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglGetSeparableFilter /* * Class: org_lwjgl_opengl_CoreGL12 - * Method: glDrawRangeElements + * Method: nglDrawRangeElements * Signature: (IIIIII)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElements @@ -530,6 +534,19 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElements CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL12 + * Method: nglDrawRangeElementsVBO + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElementsVBO + (JNIEnv *env, jclass clazz, jint mode, jint start, jint end, jint count, jint type, jint buffer_offset) +{ + CHECK_EXISTS(glDrawRangeElements) + glDrawRangeElements(mode, start, end, count, type, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL12 * Method: glTexImage3D diff --git a/src/native/common/org_lwjgl_opengl_CoreGL12.h b/src/native/common/org_lwjgl_opengl_CoreGL12.h index ae1ae62e..5a63f0c6 100644 --- a/src/native/common/org_lwjgl_opengl_CoreGL12.h +++ b/src/native/common/org_lwjgl_opengl_CoreGL12.h @@ -7,6 +7,10 @@ #ifdef __cplusplus extern "C" { #endif +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL11 */ +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL12 */ /* * Class: org_lwjgl_opengl_CoreGL12 * Method: nglColorTable @@ -287,6 +291,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglGetSeparableFilter JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElements (JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL12 + * Method: nglDrawRangeElementsVBO + * Signature: (IIIIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL12_nglDrawRangeElementsVBO + (JNIEnv *, jclass, jint, jint, jint, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL12 * Method: nglTexImage3D diff --git a/src/native/common/org_lwjgl_opengl_CoreGL14.cpp b/src/native/common/org_lwjgl_opengl_CoreGL14.cpp index d789011c..db6e283b 100644 --- a/src/native/common/org_lwjgl_opengl_CoreGL14.cpp +++ b/src/native/common/org_lwjgl_opengl_CoreGL14.cpp @@ -47,6 +47,10 @@ #include "checkGLerror.h" #include "extgl.h" +static inline const void *offsetToPointer(jint offset) { + return (const char *)NULL + offset; +} + /* * Class: org_lwjgl_opengl_CoreGL14 * Method: glFogCoordf @@ -61,7 +65,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_glFogCoordf /* * Class: org_lwjgl_opengl_CoreGL14 - * Method: glFogCoordPointer + * Method: nglFogCoordPointer * Signature: (IILjava/nio/Buffer;)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglFogCoordPointer @@ -72,6 +76,18 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglFogCoordPointer CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL14 + * Method: nglFogCoordPointerVBO + * Signature: (IILjava/nio/Buffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglFogCoordPointerVBO + (JNIEnv *env, jclass clazz, jint p1, jint p2, jint buffer_offset) { + CHECK_EXISTS(glFogCoordPointer) + glFogCoordPointer(p1, p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL14 * Method: glMultiDrawArrays @@ -163,17 +179,29 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_glSecondaryColor3ub /* * Class: org_lwjgl_opengl_CoreGL14 - * Method: glSecondaryColorPointer + * Method: nglSecondaryColorPointer * Signature: (IIILjava/nio/Buffer;)V */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglSecondaryColorPointer (JNIEnv *env, jclass clazz, jint p1, jint p2, jint p3, jobject buffer, jint offset) { CHECK_EXISTS(glSecondaryColorPointer) - GLvoid *address = (GLvoid *)(offset + (GLbyte *)env->GetDirectBufferAddress(buffer)); + const GLvoid *address = (const GLvoid *)(offset + (GLbyte *)env->GetDirectBufferAddress(buffer)); glSecondaryColorPointer(p1, p2, p3, address); CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_CoreGL14 + * Method: nglSecondaryColorPointerVBO + * Signature: (IIILjava/nio/Buffer;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglSecondaryColorPointerVBO + (JNIEnv *env, jclass clazz, jint p1, jint p2, jint p3, jint buffer_offset) { + CHECK_EXISTS(glSecondaryColorPointer) + glSecondaryColorPointer(p1, p2, p3, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_CoreGL14 * Method: glBlendFuncSeparate diff --git a/src/native/common/org_lwjgl_opengl_CoreGL14.h b/src/native/common/org_lwjgl_opengl_CoreGL14.h index 45feb216..d54fea89 100644 --- a/src/native/common/org_lwjgl_opengl_CoreGL14.h +++ b/src/native/common/org_lwjgl_opengl_CoreGL14.h @@ -8,6 +8,10 @@ extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL11 */ +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL12 */ +/* Inaccessible static: _00024assertionsDisabled */ /* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL14 */ /* * Class: org_lwjgl_opengl_CoreGL14 @@ -25,6 +29,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_glFogCoordf JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglFogCoordPointer (JNIEnv *, jclass, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL14 + * Method: nglFogCoordPointerVBO + * Signature: (III)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglFogCoordPointerVBO + (JNIEnv *, jclass, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL14 * Method: nglMultiDrawArrays @@ -81,6 +93,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_glSecondaryColor3ub JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglSecondaryColorPointer (JNIEnv *, jclass, jint, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_CoreGL14 + * Method: nglSecondaryColorPointerVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CoreGL14_nglSecondaryColorPointerVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + /* * Class: org_lwjgl_opengl_CoreGL14 * Method: glBlendFuncSeparate diff --git a/src/native/common/org_lwjgl_opengl_GL.cpp b/src/native/common/org_lwjgl_opengl_GL.cpp index 764f0192..c2e154e7 100644 --- a/src/native/common/org_lwjgl_opengl_GL.cpp +++ b/src/native/common/org_lwjgl_opengl_GL.cpp @@ -65,6 +65,10 @@ static inline jobject safeNewBuffer(JNIEnv *env, void *p, int size) { return env->NewDirectByteBuffer(p, size); } +static inline const void *offsetToPointer(jint offset) { + return (const char *)NULL + offset; +} + /* * Class: org_lwjgl_opengl_GL * Method: glActiveStencilFaceEXT @@ -2711,6 +2715,17 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglVertexAttribPointerARB(JNIEnv CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_GL + * Method: nglVertexAttribPointerARBVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglVertexAttribPointerARBVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jboolean p3, jint p4, jint buffer_offset) +{ + CHECK_EXISTS(glVertexAttribPointerARB) + glVertexAttribPointerARB((GLuint) p0, (GLint) p1, (GLuint) p2, (GLboolean) p3, (GLint) p4, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_GL * Method: nglVertexAttribPointerNV @@ -3021,6 +3036,17 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglWeightPointerARB(JNIEnv * env CHECK_GL_ERROR } +/* + * Class: org_lwjgl_opengl_GL + * Method: nglWeightPointerARBVBO + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglWeightPointerARBVBO(JNIEnv * env, jclass clazz, jint p0, jint p1, jint p2, jint buffer_offset) +{ + CHECK_EXISTS(glWeightPointerARB) + glWeightPointerARB((GLint) p0, (GLuint) p1, (GLint) p2, offsetToPointer(buffer_offset)); + CHECK_GL_ERROR +} + /* * Class: org_lwjgl_opengl_GL * Method: nglWeightsvARB @@ -3544,10 +3570,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_glWriteMaskEXT(JNIEnv * env, jcl /* * Class: org_lwjgl_opengl_GL - * Method: glBindBufferARB + * Method: nglBindBufferARB * Signature: (II)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_glBindBufferARB(JNIEnv *env, jclass clazz, jint target, jint buffer) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglBindBufferARB(JNIEnv *env, jclass clazz, jint target, jint buffer) { CHECK_EXISTS(glBindBufferARB) glBindBufferARB((GLenum) target, (GLuint) buffer); diff --git a/src/native/common/org_lwjgl_opengl_GL.h b/src/native/common/org_lwjgl_opengl_GL.h index 46b90513..aae7db0b 100644 --- a/src/native/common/org_lwjgl_opengl_GL.h +++ b/src/native/common/org_lwjgl_opengl_GL.h @@ -8,9 +8,13 @@ extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ -/* Inaccessible static: class_000240 */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL11 */ /* Inaccessible static: _00024assertionsDisabled */ -/* Inaccessible static: class_000240 */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL12 */ +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024CoreGL14 */ +/* Inaccessible static: _00024assertionsDisabled */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024GL */ /* * Class: org_lwjgl_opengl_GL * Method: glActiveStencilFaceEXT @@ -1859,6 +1863,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglVertexAttrib4usvARB JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglVertexAttribPointerARB (JNIEnv *, jclass, jint, jint, jint, jboolean, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_GL + * Method: nglVertexAttribPointerARBVBO + * Signature: (IIIZII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglVertexAttribPointerARBVBO + (JNIEnv *, jclass, jint, jint, jint, jboolean, jint, jint); + /* * Class: org_lwjgl_opengl_GL * Method: nglVertexAttribPointerNV @@ -2083,6 +2095,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglWeightivARB JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglWeightPointerARB (JNIEnv *, jclass, jint, jint, jint, jobject, jint); +/* + * Class: org_lwjgl_opengl_GL + * Method: nglWeightPointerARBVBO + * Signature: (IIII)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglWeightPointerARBVBO + (JNIEnv *, jclass, jint, jint, jint, jint); + /* * Class: org_lwjgl_opengl_GL * Method: nglWeightsvARB @@ -2261,10 +2281,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_glWriteMaskEXT /* * Class: org_lwjgl_opengl_GL - * Method: glBindBufferARB + * Method: nglBindBufferARB * Signature: (II)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_glBindBufferARB +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nglBindBufferARB (JNIEnv *, jclass, jint, jint); /* diff --git a/src/native/linux/org_lwjgl_Sys.cpp b/src/native/linux/org_lwjgl_Sys.cpp index fa09dca0..37e559bc 100644 --- a/src/native/linux/org_lwjgl_Sys.cpp +++ b/src/native/linux/org_lwjgl_Sys.cpp @@ -49,17 +49,6 @@ long int hires_timer_start; // Hires timer start long int hires_timer; // Hires timer current time /* - * Class: org_lwjgl_Sys - * Method: createIndexBuffer - * Signature: (I)Ljava/nio/ByteBuffer; - */ -JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_createIndexBuffer - (JNIEnv *env, jclass clazz, jint index) -{ - void *p = (char *)NULL + index; - return env->NewDirectByteBuffer(p, 0); -} - /* * Class: org_lwjgl_Sys * Method: getTimerResolution diff --git a/src/native/win32/org_lwjgl_Sys.cpp b/src/native/win32/org_lwjgl_Sys.cpp index 19901f38..906bd58d 100644 --- a/src/native/win32/org_lwjgl_Sys.cpp +++ b/src/native/win32/org_lwjgl_Sys.cpp @@ -49,18 +49,6 @@ __int64 hires_timer_freq; // Hires timer frequency __int64 hires_timer_start; // Hires timer start __int64 hires_timer; // Hires timer current time -/* - * Class: org_lwjgl_Sys - * Method: createIndexBuffer - * Signature: (I)Ljava/nio/ByteBuffer; - */ -JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_createIndexBuffer - (JNIEnv *env, jclass clazz, jint index) -{ - void *p = (char *)NULL + index; - return env->NewDirectByteBuffer(p, 0); -} - /* * Class: org_lwjgl_Sys * Method: getTimerResolution