Finished PBO support implementation

This commit is contained in:
Ioannis Tsakpinis 2005-01-13 20:32:31 +00:00
parent 0c6521397e
commit 2b89043b5f
7 changed files with 222 additions and 66 deletions

View File

@ -72,16 +72,16 @@ public abstract class ARBBufferObject {
public static void glBindBufferARB(int target, int buffer) {
switch ( target ) {
case ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB:
VBOTracker.getVBOArrayStack().setState(buffer);
BufferObjectTracker.getVBOArrayStack().setState(buffer);
break;
case ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB:
VBOTracker.getVBOElementStack().setState(buffer);
BufferObjectTracker.getVBOElementStack().setState(buffer);
break;
case ARBPixelBufferObject.GL_PIXEL_PACK_BUFFER_ARB:
VBOTracker.getPBOPackStack().setState(buffer);
BufferObjectTracker.getPBOPackStack().setState(buffer);
break;
case ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_ARB:
VBOTracker.getPBOUnpackStack().setState(buffer);
BufferObjectTracker.getPBOUnpackStack().setState(buffer);
break;
default:
throw new IllegalArgumentException("Unsupported VBO target " + target);
@ -94,14 +94,14 @@ public abstract class ARBBufferObject {
public static void glDeleteBuffersARB(IntBuffer buffers) {
for ( int i = buffers.position(); i < buffers.limit(); i++ ) {
int buffer_handle = buffers.get(i);
if ( VBOTracker.getVBOArrayStack().getState() == buffer_handle )
VBOTracker.getVBOArrayStack().setState(0);
if ( VBOTracker.getVBOElementStack().getState() == buffer_handle )
VBOTracker.getVBOElementStack().setState(0);
if ( VBOTracker.getPBOPackStack().getState() == buffer_handle )
VBOTracker.getPBOPackStack().setState(0);
if ( VBOTracker.getPBOUnpackStack().getState() == buffer_handle )
VBOTracker.getPBOUnpackStack().setState(0);
if ( BufferObjectTracker.getVBOArrayStack().getState() == buffer_handle )
BufferObjectTracker.getVBOArrayStack().setState(0);
if ( BufferObjectTracker.getVBOElementStack().getState() == buffer_handle )
BufferObjectTracker.getVBOElementStack().setState(0);
if ( BufferObjectTracker.getPBOPackStack().getState() == buffer_handle )
BufferObjectTracker.getPBOPackStack().setState(0);
if ( BufferObjectTracker.getPBOUnpackStack().getState() == buffer_handle )
BufferObjectTracker.getPBOUnpackStack().setState(0);
}
BufferChecks.checkDirect(buffers);
nglDeleteBuffersARB(buffers.remaining(), buffers, buffers.position());

View File

@ -59,152 +59,208 @@ public final class ARBTextureCompression {
static native void initNativeStubs() throws LWJGLException;
// ---------------------------
public static void glCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, ByteBuffer pData) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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 glCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, int buffer_offset) {
GLBufferChecks.ensureUnpackPBOenabled();
nglCompressedTexImage1DARBBO(target, level, internalformat, width, border, imageSize, buffer_offset);
}
private static native void nglCompressedTexImage1DARBBO(int target, int level, int internalformat, int width, int border, int imageSize, int buffer_offset);
// ---------------------------
// ---------------------------
public static void glCompressedTexImage2DARB(int target, int level, int internalformat, int width, int height, int border, int imageSize, ByteBuffer pData) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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 glCompressedTexImage2DARB(int target, int level, int internalformat, int width, int height, int border, int imageSize, int buffer_offset) {
GLBufferChecks.ensureUnpackPBOenabled();
nglCompressedTexImage2DARBBO(target, level, internalformat, width, height, border, imageSize, buffer_offset);
}
private static native void nglCompressedTexImage2DARBBO(int target, int level, int internalformat, int width, int height, int border, int imageSize, int buffer_offset);
// ---------------------------
// ---------------------------
public static void glCompressedTexImage3DARB(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, ByteBuffer pData) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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 glCompressedTexImage3DARB(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, int buffer_offset) {
GLBufferChecks.ensureUnpackPBOenabled();
nglCompressedTexImage3DARBBO(target, level, internalformat, width, height, depth, border, imageSize, buffer_offset);
}
private static native void nglCompressedTexImage3DARBBO(int target, int level, int internalformat, int width, int height, int depth, int border, int imageSize, int buffer_offset);
// ---------------------------
// ---------------------------
public static void glCompressedTexSubImage1DARB(int target, int level, int xoffset, int width, int border, int imageSize, ByteBuffer pData) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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 glCompressedTexSubImage1DARB(int target, int level, int xoffset, int width, int border, int imageSize, int buffer_offset) {
GLBufferChecks.ensureUnpackPBOenabled();
nglCompressedTexSubImage1DARBBO(target, level, xoffset, width, border, imageSize, buffer_offset);
}
private static native void nglCompressedTexSubImage1DARBBO(int target, int level, int xoffset, int width, int border, int imageSize, int buffer_offset);
// ---------------------------
// ---------------------------
public static void glCompressedTexSubImage2DARB(int target, int level, int xoffset, int yoffset, int width, int height, int border, int imageSize, ByteBuffer pData) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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 glCompressedTexSubImage2DARB(int target, int level, int xoffset, int yoffset, int width, int height, int border, int imageSize, int buffer_offset) {
GLBufferChecks.ensureUnpackPBOenabled();
nglCompressedTexSubImage2DARBBO(target, level, xoffset, yoffset, width, height, border, imageSize, buffer_offset);
}
private static native void nglCompressedTexSubImage2DARBBO(int target, int level, int xoffset, int yoffset, int width, int height, int border, int imageSize, int buffer_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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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) {
GLBufferChecks.ensureUnpackPBOdisabled();
BufferChecks.checkDirect(pData);
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 glCompressedTexSubImage3DARB(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int border, int imageSize, int buffer_offset) {
GLBufferChecks.ensureUnpackPBOenabled();
nglCompressedTexSubImage3DARBBO(target, level, xoffset, yoffset, zoffset, width, height, depth, border, imageSize, buffer_offset);
}
private static native void nglCompressedTexSubImage3DARBBO(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int border, int imageSize, int buffer_offset);
// ---------------------------
// ---------------------------
public static void glGetCompressedTexImageARB(int target, int lod, ByteBuffer pImg) {
GLBufferChecks.ensurePackPBOdisabled();
BufferChecks.checkDirect(pImg);
nglGetCompressedTexImageARB(target, lod, pImg, pImg.position());
}
public static void glGetCompressedTexImageARB(int target, int lod, ShortBuffer pImg) {
GLBufferChecks.ensurePackPBOdisabled();
BufferChecks.checkDirect(pImg);
nglGetCompressedTexImageARB(target, lod, pImg, pImg.position() << 1);
}
public static void glGetCompressedTexImageARB(int target, int lod, IntBuffer pImg) {
GLBufferChecks.ensurePackPBOdisabled();
BufferChecks.checkDirect(pImg);
nglGetCompressedTexImageARB(target, lod, pImg, pImg.position() << 2);
}
private static native void nglGetCompressedTexImageARB(int target, int lod, Buffer pImg, int pImg_offset);
public static void glGetCompressedTexImageARB(int target, int lod, int buffer_offset) {
GLBufferChecks.ensurePackPBOenabled();
nglGetCompressedTexImageARBBO(target, lod, buffer_offset);
}
private static native void nglGetCompressedTexImageARBBO(int target, int lod, int buffer_offset);
// ---------------------------
}

View File

@ -0,0 +1,100 @@
/*
* Copyright (c) 2002-2004 LWJGL 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 'LWJGL' 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;
import java.util.WeakHashMap;
import java.util.Map;
/** Track Vertex Buffer Objects by context. */
final class BufferObjectTracker {
private static BufferObjectTracker current_tracker;
private static final Map contextToTracker = new WeakHashMap(3, 1.0f);
private final StateStack vbo_array_stack;
private final StateStack vbo_element_stack;
private final StateStack pbo_pack_stack;
private final StateStack pbo_unpack_stack;
private final StateStack attrib_stack;
private BufferObjectTracker() {
int stack_size = Math.max(1, Util.glGetInteger(GL11.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH));
vbo_array_stack = new StateStack(stack_size, 0);
vbo_element_stack = new StateStack(stack_size, 0);
pbo_pack_stack = new StateStack(stack_size, 0);
pbo_unpack_stack = new StateStack(stack_size, 0);
attrib_stack = new StateStack(stack_size, 0);
}
static StateStack getVBOArrayStack() {
return current_tracker.vbo_array_stack;
}
static StateStack getVBOElementStack() {
return current_tracker.vbo_element_stack;
}
static StateStack getPBOPackStack() {
return current_tracker.pbo_pack_stack;
}
static StateStack getPBOUnpackStack() {
return current_tracker.pbo_unpack_stack;
}
static StateStack getClientAttribStack() {
return current_tracker.attrib_stack;
}
/**
* Called after a GLContext has been made current. This will set up the current VBO tracker.
*
* @param context
*/
static void setCurrent(Object context) {
if ( context == null ) {
current_tracker = null;
return;
}
current_tracker = (BufferObjectTracker)contextToTracker.get(context);
if ( current_tracker == null ) {
current_tracker = new BufferObjectTracker();
contextToTracker.put(context, current_tracker);
}
}
}

View File

@ -1426,24 +1426,24 @@ public final class GL11 {
public static native void glPopMatrix();
public static void glPushClientAttrib(int mask) {
VBOTracker.getClientAttribStack().pushState();
VBOTracker.getClientAttribStack().setState(mask);
BufferObjectTracker.getClientAttribStack().pushState();
BufferObjectTracker.getClientAttribStack().setState(mask);
if ((mask & GL_CLIENT_VERTEX_ARRAY_BIT) != 0) {
VBOTracker.getVBOArrayStack().pushState();
VBOTracker.getVBOElementStack().pushState();
VBOTracker.getPBOPackStack().pushState();
VBOTracker.getPBOUnpackStack().pushState();
BufferObjectTracker.getVBOArrayStack().pushState();
BufferObjectTracker.getVBOElementStack().pushState();
BufferObjectTracker.getPBOPackStack().pushState();
BufferObjectTracker.getPBOUnpackStack().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();
VBOTracker.getPBOPackStack().popState();
VBOTracker.getPBOUnpackStack().popState();
if ((BufferObjectTracker.getClientAttribStack().popState() & GL_CLIENT_VERTEX_ARRAY_BIT) != 0) {
BufferObjectTracker.getVBOArrayStack().popState();
BufferObjectTracker.getVBOElementStack().popState();
BufferObjectTracker.getPBOPackStack().popState();
BufferObjectTracker.getPBOUnpackStack().popState();
}
nglPopClientAttrib();
}

View File

@ -82,10 +82,10 @@ public final class GL15 {
public static void glBindBuffer(int target, int buffer) {
switch ( target ) {
case GL_ELEMENT_ARRAY_BUFFER:
VBOTracker.getVBOElementStack().setState(buffer);
BufferObjectTracker.getVBOElementStack().setState(buffer);
break;
case GL_ARRAY_BUFFER:
VBOTracker.getVBOArrayStack().setState(buffer);
BufferObjectTracker.getVBOArrayStack().setState(buffer);
break;
default:
throw new IllegalArgumentException("Unsupported VBO target " + target);
@ -99,10 +99,10 @@ public final class GL15 {
BufferChecks.checkDirect(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);
if ( BufferObjectTracker.getVBOElementStack().getState() == buffer_handle )
BufferObjectTracker.getVBOElementStack().setState(0);
if ( BufferObjectTracker.getVBOArrayStack().getState() == buffer_handle )
BufferObjectTracker.getVBOArrayStack().setState(0);
}
nglDeleteBuffers(buffers.remaining(), buffers, buffers.position());
}

View File

@ -52,49 +52,49 @@ class GLBufferChecks {
/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureArrayVBOdisabled() {
if ( VBOTracker.getVBOArrayStack().getState() != 0 )
if ( BufferObjectTracker.getVBOArrayStack().getState() != 0 )
throw new OpenGLException("Cannot use Buffers when Array Buffer Object is enabled");
}
/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureArrayVBOenabled() {
if ( VBOTracker.getVBOArrayStack().getState() == 0 )
if ( BufferObjectTracker.getVBOArrayStack().getState() == 0 )
throw new OpenGLException("Cannot use offsets when Array Buffer Object is disabled");
}
/** Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureElementVBOdisabled() {
if ( VBOTracker.getVBOElementStack().getState() != 0 )
if ( BufferObjectTracker.getVBOElementStack().getState() != 0 )
throw new OpenGLException("Cannot use Buffers when Element Array Buffer Object is enabled");
}
/** Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureElementVBOenabled() {
if ( VBOTracker.getVBOElementStack().getState() == 0 )
if ( BufferObjectTracker.getVBOElementStack().getState() == 0 )
throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled");
}
/** Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensurePackPBOdisabled() {
if ( VBOTracker.getPBOPackStack().getState() != 0 )
if ( BufferObjectTracker.getPBOPackStack().getState() != 0 )
throw new OpenGLException("Cannot use Buffers when Pixel Pack Buffer Object is enabled");
}
/** Helper method to ensure that pixel pack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensurePackPBOenabled() {
if ( VBOTracker.getPBOPackStack().getState() == 0 )
if ( BufferObjectTracker.getPBOPackStack().getState() == 0 )
throw new OpenGLException("Cannot use offsets when Pixel Pack Buffer Object is disabled");
}
/** Helper method to ensure that pixel unpack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureUnpackPBOdisabled() {
if ( VBOTracker.getPBOUnpackStack().getState() != 0 )
if ( BufferObjectTracker.getPBOUnpackStack().getState() != 0 )
throw new OpenGLException("Cannot use Buffers when Pixel Unpack Buffer Object is enabled");
}
/** Helper method to ensure that pixel unpack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureUnpackPBOenabled() {
if ( VBOTracker.getPBOUnpackStack().getState() == 0 )
if ( BufferObjectTracker.getPBOUnpackStack().getState() == 0 )
throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled");
}

View File

@ -243,7 +243,7 @@ public final class GLContext {
if ( did_auto_load )
unloadOpenGLLibrary();
currentContext = null;
VBOTracker.setCurrent(null);
BufferObjectTracker.setCurrent(null);
return;
}
// Is this the same as last time?
@ -261,7 +261,7 @@ public final class GLContext {
try {
loadStubs();
currentContext = new WeakReference(context);
VBOTracker.setCurrent(context);
BufferObjectTracker.setCurrent(context);
} catch (LWJGLException e) {
if ( did_auto_load )
unloadOpenGLLibrary();