New extensions and static import modifications
This commit is contained in:
parent
17cef91b6a
commit
0e70f051bd
|
@ -0,0 +1,174 @@
|
|||
/*
|
||||
* 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$
|
||||
*
|
||||
* ARB_vertex_buffer_object constants.
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public final class ARBBufferObject {
|
||||
|
||||
/*
|
||||
* Accepted by the <usage> parameter of BufferDataARB:
|
||||
*/
|
||||
public static final int GL_STREAM_DRAW_ARB = 0x88E0;
|
||||
public static final int GL_STREAM_READ_ARB = 0x88E1;
|
||||
public static final int GL_STREAM_COPY_ARB = 0x88E2;
|
||||
public static final int GL_STATIC_DRAW_ARB = 0x88E4;
|
||||
public static final int GL_STATIC_READ_ARB = 0x88E5;
|
||||
public static final int GL_STATIC_COPY_ARB = 0x88E6;
|
||||
public static final int GL_DYNAMIC_DRAW_ARB = 0x88E8;
|
||||
public static final int GL_DYNAMIC_READ_ARB = 0x88E9;
|
||||
public static final int GL_DYNAMIC_COPY_ARB = 0x88EA;
|
||||
|
||||
/*
|
||||
* Accepted by the <access> parameter of MapBufferARB:
|
||||
*/
|
||||
public static final int GL_READ_ONLY_ARB = 0x88B8;
|
||||
public static final int GL_WRITE_ONLY_ARB = 0x88B9;
|
||||
public static final int GL_READ_WRITE_ARB = 0x88BA;
|
||||
|
||||
/*
|
||||
* Accepted by the <pname> parameter of GetBufferParameterivARB:
|
||||
*/
|
||||
public static final int GL_BUFFER_SIZE_ARB = 0x8764;
|
||||
public static final int GL_BUFFER_USAGE_ARB = 0x8765;
|
||||
public static final int GL_BUFFER_ACCESS_ARB = 0x88BB;
|
||||
public static final int GL_BUFFER_MAPPED_ARB = 0x88BC;
|
||||
public static final int GL_BUFFER_MAP_POINTER_ARB = 0x88BD;
|
||||
|
||||
public static void glBindBufferARB(int target, int buffer) {
|
||||
switch (target) {
|
||||
case ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB:
|
||||
VBOTracker.getVBOElementStack().setState(buffer);
|
||||
break;
|
||||
case ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB:
|
||||
VBOTracker.getVBOArrayStack().setState(buffer);
|
||||
break;
|
||||
default: throw new IllegalArgumentException("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);
|
||||
public static void glGenBuffersARB(IntBuffer buffers) {
|
||||
nglGenBuffersARB(buffers.remaining(), buffers, buffers.position());
|
||||
}
|
||||
private static native void nglGenBuffersARB(int n, IntBuffer buffers, int buffers_offset);
|
||||
public static native boolean glIsBufferARB(int buffer);
|
||||
public static void glBufferDataARB(int target, int size, ByteBuffer data, int usage) {
|
||||
nglBufferDataARB(target, size, data, data != null ? data.position() : 0, usage);
|
||||
}
|
||||
public static void glBufferDataARB(int target, int size, ShortBuffer data, int usage) {
|
||||
nglBufferDataARB(target, size, data, data != null ? data.position()<<1 : 0, usage);
|
||||
}
|
||||
public static void glBufferDataARB(int target, int size, FloatBuffer data, int usage) {
|
||||
nglBufferDataARB(target, size, data, data != null ? data.position()<<2 : 0, usage);
|
||||
}
|
||||
public static void glBufferDataARB(int target, int size, IntBuffer data, int usage) {
|
||||
nglBufferDataARB(target, size, data, data != null ? data.position()<<2 : 0, usage);
|
||||
}
|
||||
private static native void nglBufferDataARB(int target, int size, Buffer data, int data_offset, int usage);
|
||||
public static void glBufferSubDataARB(int target, int offset, ByteBuffer data) {
|
||||
nglBufferSubDataARB(target, offset, data.remaining(), data, data.position());
|
||||
}
|
||||
public static void glBufferSubDataARB(int target, int offset, ShortBuffer data) {
|
||||
nglBufferSubDataARB(target, offset, data.remaining()<<1, data, data.position()<<1);
|
||||
}
|
||||
public static void glBufferSubDataARB(int target, int offset, FloatBuffer data) {
|
||||
nglBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
|
||||
}
|
||||
public static void glBufferSubDataARB(int target, int offset, IntBuffer data) {
|
||||
nglBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
|
||||
}
|
||||
private static native void nglBufferSubDataARB(int target, int offset, int size, Buffer data, int data_offset);
|
||||
public static void glGetBufferSubDataARB(int target, int offset, ByteBuffer data) {
|
||||
nglGetBufferSubDataARB(target, offset, data.remaining(), data, data.position());
|
||||
}
|
||||
public static void glGetBufferSubDataARB(int target, int offset, ShortBuffer data) {
|
||||
nglGetBufferSubDataARB(target, offset, data.remaining()<<1, data, data.position()<<1);
|
||||
}
|
||||
public static void glGetBufferSubDataARB(int target, int offset, IntBuffer data) {
|
||||
nglGetBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
|
||||
}
|
||||
public static void glGetBufferSubDataARB(int target, int offset, FloatBuffer data) {
|
||||
nglGetBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
|
||||
}
|
||||
private static native void nglGetBufferSubDataARB(int target, int offset, int size, Buffer data, int data_offset);
|
||||
/**
|
||||
* glMapBufferARB maps a gl vertex buffer buffer to a ByteBuffer. The oldBuffer argument can be null, in
|
||||
* which case a new ByteBuffer will be created, pointing to the returned memory. If oldBuffer is non-null,
|
||||
* it will be returned if it points to the same mapped memory, otherwise a new ByteBuffer is created.
|
||||
* That way, an application will normally use glMapBufferARB like this:
|
||||
*
|
||||
* ByteBuffer mapped_buffer;
|
||||
* mapped_buffer = glMapBufferARB(..., ..., ..., null);
|
||||
* ...
|
||||
* // Another map on the same buffer
|
||||
* mapped_buffer = glMapBufferARB(..., ..., ..., mapped_buffer);
|
||||
*
|
||||
* @param size The size of the buffer area.
|
||||
* @param oldBuffer A ByteBuffer. If this argument points to the same address as the new mapping, it will be returned and
|
||||
* no new buffer will be created. In that case, size is ignored.
|
||||
* @return A ByteBuffer representing the mapped buffer memory.
|
||||
*/
|
||||
public static native ByteBuffer glMapBufferARB(int target, int access, int size, ByteBuffer oldBuffer);
|
||||
public static native boolean glUnmapBufferARB(int target);
|
||||
public static void glGetBufferParameterARB(int target, int pname, IntBuffer params) {
|
||||
BufferChecks.checkBuffer(params);
|
||||
nglGetBufferParameterivARB(target, pname, params, params.position());
|
||||
}
|
||||
private static native void nglGetBufferParameterivARB(int target, int pname, IntBuffer params, int params_offset);
|
||||
public static native ByteBuffer glGetBufferPointerARB(int target, int pname, int size);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* 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,
|
||||
|
@ -12,7 +12,7 @@
|
|||
* * 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
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
public final class ARBFragmentProgram extends ARBProgram {
|
||||
public final class ARBFragmentProgram {
|
||||
|
||||
/*
|
||||
* Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, by the
|
||||
|
|
|
@ -45,7 +45,7 @@ import java.nio.ByteBuffer;
|
|||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
class ARBProgram {
|
||||
public final class ARBProgram {
|
||||
|
||||
/*
|
||||
* Accepted by the <format> parameter of ProgramStringARB:
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
/*
|
||||
/*
|
||||
* 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
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
*
|
||||
* * 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
|
||||
* * 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
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
@ -41,16 +41,21 @@
|
|||
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
|
||||
public final class ARBVertexBufferObject {
|
||||
|
||||
/*
|
||||
* Accepted by the <target> parameters of BindBufferARB, BufferDataARB,
|
||||
* BufferSubDataARB, MapBufferARB, UnmapBufferARB,
|
||||
* GetBufferSubDataARB, GetBufferParameterivARB, and
|
||||
* GetBufferPointervARB:
|
||||
*/
|
||||
public static final int GL_ARRAY_BUFFER_ARB = 0x8892;
|
||||
public static final int GL_ELEMENT_ARRAY_BUFFER_ARB = 0x8893;
|
||||
|
||||
/*
|
||||
* Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
|
||||
* GetFloatv, and GetDoublev:
|
||||
*/
|
||||
public static final int GL_ARRAY_BUFFER_BINDING_ARB = 0x8894;
|
||||
public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB = 0x8895;
|
||||
public static final int GL_VERTEX_ARRAY_BUFFER_BINDING_ARB = 0x8896;
|
||||
|
@ -62,116 +67,10 @@ public final class ARBVertexBufferObject {
|
|||
public static final int GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = 0x889C;
|
||||
public static final int GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = 0x889D;
|
||||
public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB = 0x889E;
|
||||
|
||||
/*
|
||||
* Accepted by the <pname> parameter of GetVertexAttribivARB:
|
||||
*/
|
||||
public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = 0x889F;
|
||||
public static final int GL_STREAM_DRAW_ARB = 0x88E0;
|
||||
public static final int GL_STREAM_READ_ARB = 0x88E1;
|
||||
public static final int GL_STREAM_COPY_ARB = 0x88E2;
|
||||
public static final int GL_STATIC_DRAW_ARB = 0x88E4;
|
||||
public static final int GL_STATIC_READ_ARB = 0x88E5;
|
||||
public static final int GL_STATIC_COPY_ARB = 0x88E6;
|
||||
public static final int GL_DYNAMIC_DRAW_ARB = 0x88E8;
|
||||
public static final int GL_DYNAMIC_READ_ARB = 0x88E9;
|
||||
public static final int GL_DYNAMIC_COPY_ARB = 0x88EA;
|
||||
public static final int GL_READ_ONLY_ARB = 0x88B8;
|
||||
public static final int GL_WRITE_ONLY_ARB = 0x88B9;
|
||||
public static final int GL_READ_WRITE_ARB = 0x88BA;
|
||||
public static final int GL_BUFFER_SIZE_ARB = 0x8764;
|
||||
public static final int GL_BUFFER_USAGE_ARB = 0x8765;
|
||||
public static final int GL_BUFFER_ACCESS_ARB = 0x88BB;
|
||||
public static final int GL_BUFFER_MAPPED_ARB = 0x88BC;
|
||||
public static final int GL_BUFFER_MAP_POINTER_ARB = 0x88BD;
|
||||
|
||||
public static void glBindBufferARB(int target, int buffer) {
|
||||
switch (target) {
|
||||
case GL_ELEMENT_ARRAY_BUFFER_ARB:
|
||||
VBOTracker.getVBOElementStack().setState(buffer);
|
||||
break;
|
||||
case GL_ARRAY_BUFFER_ARB:
|
||||
VBOTracker.getVBOArrayStack().setState(buffer);
|
||||
break;
|
||||
default: throw new IllegalArgumentException("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);
|
||||
public static void glGenBuffersARB(IntBuffer buffers) {
|
||||
nglGenBuffersARB(buffers.remaining(), buffers, buffers.position());
|
||||
}
|
||||
private static native void nglGenBuffersARB(int n, IntBuffer buffers, int buffers_offset);
|
||||
public static native boolean glIsBufferARB(int buffer);
|
||||
public static void glBufferDataARB(int target, int size, ByteBuffer data, int usage) {
|
||||
nglBufferDataARB(target, size, data, data != null ? data.position() : 0, usage);
|
||||
}
|
||||
public static void glBufferDataARB(int target, int size, ShortBuffer data, int usage) {
|
||||
nglBufferDataARB(target, size, data, data != null ? data.position()<<1 : 0, usage);
|
||||
}
|
||||
public static void glBufferDataARB(int target, int size, FloatBuffer data, int usage) {
|
||||
nglBufferDataARB(target, size, data, data != null ? data.position()<<2 : 0, usage);
|
||||
}
|
||||
public static void glBufferDataARB(int target, int size, IntBuffer data, int usage) {
|
||||
nglBufferDataARB(target, size, data, data != null ? data.position()<<2 : 0, usage);
|
||||
}
|
||||
private static native void nglBufferDataARB(int target, int size, Buffer data, int data_offset, int usage);
|
||||
public static void glBufferSubDataARB(int target, int offset, ByteBuffer data) {
|
||||
nglBufferSubDataARB(target, offset, data.remaining(), data, data.position());
|
||||
}
|
||||
public static void glBufferSubDataARB(int target, int offset, ShortBuffer data) {
|
||||
nglBufferSubDataARB(target, offset, data.remaining()<<1, data, data.position()<<1);
|
||||
}
|
||||
public static void glBufferSubDataARB(int target, int offset, FloatBuffer data) {
|
||||
nglBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
|
||||
}
|
||||
public static void glBufferSubDataARB(int target, int offset, IntBuffer data) {
|
||||
nglBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
|
||||
}
|
||||
private static native void nglBufferSubDataARB(int target, int offset, int size, Buffer data, int data_offset);
|
||||
public static void glGetBufferSubDataARB(int target, int offset, ByteBuffer data) {
|
||||
nglGetBufferSubDataARB(target, offset, data.remaining(), data, data.position());
|
||||
}
|
||||
public static void glGetBufferSubDataARB(int target, int offset, ShortBuffer data) {
|
||||
nglGetBufferSubDataARB(target, offset, data.remaining()<<1, data, data.position()<<1);
|
||||
}
|
||||
public static void glGetBufferSubDataARB(int target, int offset, IntBuffer data) {
|
||||
nglGetBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
|
||||
}
|
||||
public static void glGetBufferSubDataARB(int target, int offset, FloatBuffer data) {
|
||||
nglGetBufferSubDataARB(target, offset, data.remaining()<<2, data, data.position()<<2);
|
||||
}
|
||||
private static native void nglGetBufferSubDataARB(int target, int offset, int size, Buffer data, int data_offset);
|
||||
/**
|
||||
* glMapBufferARB maps a gl vertex buffer buffer to a ByteBuffer. The oldBuffer argument can be null, in
|
||||
* which case a new ByteBuffer will be created, pointing to the returned memory. If oldBuffer is non-null,
|
||||
* it will be returned if it points to the same mapped memory, otherwise a new ByteBuffer is created.
|
||||
* That way, an application will normally use glMapBufferARB like this:
|
||||
*
|
||||
* ByteBuffer mapped_buffer;
|
||||
* mapped_buffer = glMapBufferARB(..., ..., ..., null);
|
||||
* ...
|
||||
* // Another map on the same buffer
|
||||
* mapped_buffer = glMapBufferARB(..., ..., ..., mapped_buffer);
|
||||
*
|
||||
* @param size The size of the buffer area.
|
||||
* @param oldBuffer A ByteBuffer. If this argument points to the same address as the new mapping, it will be returned and
|
||||
* no new buffer will be created. In that case, size is ignored.
|
||||
* @return A ByteBuffer representing the mapped buffer memory.
|
||||
*/
|
||||
public static native ByteBuffer glMapBufferARB(int target, int access, int size, ByteBuffer oldBuffer);
|
||||
public static native boolean glUnmapBufferARB(int target);
|
||||
public static void glGetBufferParameterARB(int target, int pname, IntBuffer params) {
|
||||
BufferChecks.checkBuffer(params);
|
||||
nglGetBufferParameterivARB(target, pname, params, params.position());
|
||||
}
|
||||
private static native void nglGetBufferParameterivARB(int target, int pname, IntBuffer params, int params_offset);
|
||||
public static native ByteBuffer glGetBufferPointerARB(int target, int pname, int size);
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import java.nio.FloatBuffer;
|
|||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
public final class ARBVertexProgram extends ARBProgram {
|
||||
public final class ARBVertexProgram {
|
||||
|
||||
/*
|
||||
* Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, by the
|
||||
|
@ -87,7 +87,7 @@ public final class ARBVertexProgram extends ARBProgram {
|
|||
public static final int GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B1;
|
||||
public static final int GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B2;
|
||||
public static final int GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B3;
|
||||
|
||||
|
||||
/*
|
||||
* Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
|
||||
* GetFloatv, and GetDoublev:
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* Created by LWJGL.
|
||||
* User: spasi
|
||||
* Date: 28-03-2004
|
||||
* Time: 10:01:34 pm
|
||||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
public final class EXTDepthBoundsTest {
|
||||
|
||||
/*
|
||||
Accepted by the <cap> parameter of Enable, Disable, and IsEnabled,
|
||||
and by the <pname> parameter of GetBooleanv, GetIntegerv,
|
||||
GetFloatv, and GetDoublev:
|
||||
*/
|
||||
public static final int DEPTH_BOUNDS_TEST_EXT = 0x8890;
|
||||
|
||||
/*
|
||||
Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
|
||||
GetFloatv, and GetDoublev:
|
||||
*/
|
||||
public static final int DEPTH_BOUNDS_EXT = 0x8891;
|
||||
|
||||
public static native void glDepthBoundsEXT(float zmin, float zmax);
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* Created by LWJGL.
|
||||
* User: spasi
|
||||
* Date: 28 Ìáñ 2004
|
||||
* Time: 10:12:12 ìì
|
||||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
public final class EXTPixelBufferObject {
|
||||
|
||||
public static final int GL_PIXEL_PACK_BUFFER_EXT = 0x88EB;
|
||||
|
||||
public static final int GL_PIXEL_UNPACK_BUFFER_EXT = 0x88EC;
|
||||
|
||||
}
|
|
@ -93,11 +93,14 @@ public final class GLContext {
|
|||
public static boolean GL_EXT_bgra;
|
||||
public static boolean GL_EXT_blend_func_separate;
|
||||
public static boolean GL_EXT_blend_subtract;
|
||||
public static boolean GL_EXT_Cg_shader;
|
||||
public static boolean GL_EXT_compiled_vertex_array;
|
||||
public static boolean GL_EXT_depth_bounds_test;
|
||||
public static boolean GL_EXT_draw_range_elements;
|
||||
public static boolean GL_EXT_fog_coord;
|
||||
public static boolean GL_EXT_multi_draw_arrays;
|
||||
public static boolean GL_EXT_packed_pixels;
|
||||
public static boolean GL_EXT_pixel_buffer_object;
|
||||
public static boolean GL_EXT_point_parameters;
|
||||
public static boolean GL_EXT_rescale_normal;
|
||||
public static boolean GL_EXT_secondary_color;
|
||||
|
@ -136,6 +139,7 @@ public final class GLContext {
|
|||
public static boolean GL_NV_float_buffer;
|
||||
public static boolean GL_NV_fog_distance;
|
||||
public static boolean GL_NV_fragment_program;
|
||||
public static boolean GL_NV_fragment_program_option;
|
||||
public static boolean GL_NV_half_float;
|
||||
public static boolean GL_NV_light_max_exponent;
|
||||
public static boolean GL_NV_multisample_filter_hint;
|
||||
|
@ -159,6 +163,7 @@ public final class GLContext {
|
|||
public static boolean GL_NV_vertex_program;
|
||||
public static boolean GL_NV_vertex_program1_1;
|
||||
public static boolean GL_NV_vertex_program2;
|
||||
public static boolean GL_NV_vertex_program2_option;
|
||||
|
||||
public static boolean OpenGL11;
|
||||
public static boolean OpenGL12;
|
||||
|
|
|
@ -42,7 +42,7 @@ package org.lwjgl.opengl;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
public final class NVFragmentProgram extends NVProgram {
|
||||
public final class NVFragmentProgram {
|
||||
|
||||
/*
|
||||
Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, by the
|
||||
|
@ -98,20 +98,5 @@ public final class NVFragmentProgram extends NVProgram {
|
|||
|
||||
// ---------------------------
|
||||
|
||||
public static native void glProgramLocalParameter4fARB(int target, int index, float x, float y, float z, float w);
|
||||
|
||||
// ---------------------------
|
||||
|
||||
public static void glGetProgramLocalParameterARB(int target, int index, FloatBuffer params) {
|
||||
BufferChecks.checkBuffer(params);
|
||||
nglGetProgramLocalParameterfvARB(target, index, params, params.position());
|
||||
}
|
||||
|
||||
private static native void nglGetProgramLocalParameterfvARB(
|
||||
int target,
|
||||
int index,
|
||||
FloatBuffer params,
|
||||
int params_offset);
|
||||
// ---------------------------
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ import java.nio.Buffer;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
class NVProgram {
|
||||
public final class NVProgram {
|
||||
|
||||
/*
|
||||
Accepted by the <pname> parameter of GetProgramivNV:
|
||||
|
@ -109,33 +109,27 @@ class NVProgram {
|
|||
nglGetProgramStringNV(programID, parameterName, paramString, paramString.position());
|
||||
}
|
||||
|
||||
private static native void nglGetProgramStringNV(
|
||||
int programID,
|
||||
int parameterName,
|
||||
Buffer paramString,
|
||||
int paramStringOffset);
|
||||
private static native void nglGetProgramStringNV(int programID, int parameterName, Buffer paramString, int paramStringOffset);
|
||||
// ---------------------------
|
||||
|
||||
public static native boolean glIsProgramNV(int programID);
|
||||
|
||||
// ---------------------------
|
||||
public static boolean glAreProgramsResidentNV(IntBuffer programIDs, ByteBuffer programResidences) {
|
||||
if (programIDs.remaining() != programResidences.remaining())
|
||||
if ( programIDs.remaining() != programResidences.remaining() )
|
||||
throw new IllegalArgumentException("programIDs.remaining() != programResidences.remaining()");
|
||||
return nglAreProgramsResidentNV(
|
||||
programIDs.remaining(),
|
||||
programIDs,
|
||||
programIDs.position(),
|
||||
programResidences,
|
||||
programResidences.position());
|
||||
return nglAreProgramsResidentNV(programIDs.remaining(),
|
||||
programIDs,
|
||||
programIDs.position(),
|
||||
programResidences,
|
||||
programResidences.position());
|
||||
}
|
||||
|
||||
private static native boolean nglAreProgramsResidentNV(
|
||||
int n,
|
||||
IntBuffer programIDs,
|
||||
int programIDsOffset,
|
||||
ByteBuffer programResidences,
|
||||
int programResidencesOffset);
|
||||
private static native boolean nglAreProgramsResidentNV(int n,
|
||||
IntBuffer programIDs,
|
||||
int programIDsOffset,
|
||||
ByteBuffer programResidences,
|
||||
int programResidencesOffset);
|
||||
// ---------------------------
|
||||
|
||||
// ---------------------------
|
||||
|
|
|
@ -46,9 +46,7 @@ import java.nio.FloatBuffer;
|
|||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
|
||||
|
||||
public final class NVVertexProgram extends NVProgram {
|
||||
public final class NVVertexProgram {
|
||||
|
||||
/*
|
||||
Accepted by the <cap> parameter of Disable, Enable, and IsEnabled,
|
||||
|
|
|
@ -54,10 +54,7 @@ import org.lwjgl.Display;
|
|||
import org.lwjgl.DisplayMode;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.opengl.NVVertexProgram;
|
||||
import org.lwjgl.opengl.Window;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.lwjgl.opengl.glu.GLU;
|
||||
|
||||
public class Grass {
|
||||
|
@ -82,7 +79,7 @@ public class Grass {
|
|||
mode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == -1) {
|
||||
System.out.println("did not find suitable mode");
|
||||
|
@ -140,7 +137,7 @@ public class Grass {
|
|||
public static void main(String[] args) {
|
||||
System.out.println("Vertex program supported: " + GLContext.GL_NV_vertex_program);
|
||||
IntBuffer int_buf = BufferUtils.createIntBuffer(1);
|
||||
NVVertexProgram.glGenProgramsNV(int_buf);
|
||||
NVProgram.glGenProgramsNV(int_buf);
|
||||
if (int_buf.get(0) == 0)
|
||||
throw new RuntimeException("Could not allocate new vertex program id!");
|
||||
|
||||
|
@ -150,7 +147,7 @@ public class Grass {
|
|||
program_buf.order(ByteOrder.nativeOrder());
|
||||
program_buf.put(program);
|
||||
program_buf.flip();
|
||||
NVVertexProgram.glLoadProgramNV(
|
||||
NVProgram.glLoadProgramNV(
|
||||
NVVertexProgram.GL_VERTEX_PROGRAM_NV,
|
||||
program_handle,
|
||||
program_buf);
|
||||
|
@ -286,7 +283,7 @@ public class Grass {
|
|||
|
||||
private static void grsDraw() {
|
||||
GL11.glEnable(NVVertexProgram.GL_VERTEX_PROGRAM_NV);
|
||||
NVVertexProgram.glBindProgramNV(NVVertexProgram.GL_VERTEX_PROGRAM_NV, program_handle);
|
||||
NVProgram.glBindProgramNV(NVVertexProgram.GL_VERTEX_PROGRAM_NV, program_handle);
|
||||
NVVertexProgram.glTrackMatrixNV(
|
||||
NVVertexProgram.GL_VERTEX_PROGRAM_NV,
|
||||
0,
|
||||
|
|
|
@ -41,39 +41,37 @@
|
|||
|
||||
package org.lwjgl.test.opengl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.lwjgl.Display;
|
||||
import org.lwjgl.DisplayMode;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.ARBVertexBufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.opengl.Window;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.lwjgl.opengl.glu.GLU;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
public final class VBOIndexTest {
|
||||
|
||||
static {
|
||||
try {
|
||||
//find first display mode that allows us 640*480*16
|
||||
//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) {
|
||||
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) {
|
||||
if ( mode != -1 ) {
|
||||
//select above found displaymode
|
||||
System.out.println("Setting display mode to "+modes[mode]);
|
||||
System.out.println("Setting display mode to " + modes[mode]);
|
||||
Display.setDisplayMode(modes[mode]);
|
||||
System.out.println("Created display.");
|
||||
}
|
||||
|
@ -81,22 +79,26 @@ public final class VBOIndexTest {
|
|||
System.err.println("Failed to create display due to " + e);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
Window.create("LWJGL Game Example", 16, 0, 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;
|
||||
|
||||
static {
|
||||
try {
|
||||
Window.create("LWJGL Game Example", 16, 0, 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;
|
||||
|
@ -105,134 +107,146 @@ public final class VBOIndexTest {
|
|||
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.update();
|
||||
|
||||
if (Window.isMinimized())
|
||||
Thread.sleep(200);
|
||||
else if (Window.isCloseRequested())
|
||||
System.exit(0);
|
||||
|
||||
mainLoop();
|
||||
render();
|
||||
}
|
||||
} 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;
|
||||
|
||||
if (Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0)
|
||||
System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel());
|
||||
for (int i = 0; i < Mouse.getButtonCount(); i++)
|
||||
if (Mouse.isButtonDown(i))
|
||||
System.out.println("Button " + i + " down");
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
|
||||
finished = true;
|
||||
for (int i = 0; i < Keyboard.getNumKeyboardEvents(); i++) {
|
||||
Keyboard.next();
|
||||
if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState())
|
||||
finished = true;
|
||||
if (Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState())
|
||||
System.out.println("Current time: " + Sys.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All rendering is done in here
|
||||
*/
|
||||
private static void render() {
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
|
||||
GL11.glRotatef(angle, 0, 0, 1.0f);
|
||||
|
||||
public static void main(String[] arguments) {
|
||||
try {
|
||||
init();
|
||||
while ( !finished ) {
|
||||
Window.update();
|
||||
|
||||
ByteBuffer new_mapped_buffer = ARBVertexBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, ARBVertexBufferObject.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;
|
||||
if ( Window.isMinimized() )
|
||||
Thread.sleep(200);
|
||||
else if ( Window.isCloseRequested() )
|
||||
System.exit(0);
|
||||
|
||||
new_mapped_buffer = ARBVertexBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, ARBVertexBufferObject.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 (ARBVertexBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) &&
|
||||
ARBVertexBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB)) {
|
||||
GL11.glDrawElements(GL11.GL_QUADS, 4, GL11.GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
private static void init() throws Exception {
|
||||
Sys.setTime(0);
|
||||
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
|
||||
System.out.println("Timer resolution: " + Sys.getTimerResolution());
|
||||
// Go into orthographic projection mode.
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight());
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
|
||||
if (!GLContext.GL_ARB_vertex_buffer_object) {
|
||||
System.out.println("ARB VBO not supported!");
|
||||
System.exit(1);
|
||||
mainLoop();
|
||||
render();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
IntBuffer int_buffer = ByteBuffer.allocateDirect(8).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
ARBVertexBufferObject.glGenBuffersARB(int_buffer);
|
||||
buffer_id = int_buffer.get(0);
|
||||
indices_buffer_id = int_buffer.get(1);
|
||||
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, buffer_id);
|
||||
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.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();
|
||||
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 2*4*4, (ByteBuffer)null, ARBVertexBufferObject.GL_STREAM_DRAW_ARB);
|
||||
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 4*4, (ByteBuffer)null, ARBVertexBufferObject.GL_STREAM_DRAW_ARB);
|
||||
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
GL11.glVertexPointer(2, GL11.GL_FLOAT, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
ARBVertexBufferObject.glDeleteBuffersARB(int_buffer);
|
||||
Window.destroy();
|
||||
try {
|
||||
Display.resetDisplayMode();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All calculations are done in here
|
||||
*/
|
||||
private static void mainLoop() {
|
||||
angle += 1f;
|
||||
if ( angle > 360.0f )
|
||||
angle = 0.0f;
|
||||
|
||||
if ( Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0 )
|
||||
System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel());
|
||||
for ( int i = 0; i < Mouse.getButtonCount(); i++ )
|
||||
if ( Mouse.isButtonDown(i) )
|
||||
System.out.println("Button " + i + " down");
|
||||
if ( Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) )
|
||||
finished = true;
|
||||
for ( int i = 0; i < Keyboard.getNumKeyboardEvents(); i++ ) {
|
||||
Keyboard.next();
|
||||
if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState() )
|
||||
finished = true;
|
||||
if ( Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState() )
|
||||
System.out.println("Current time: " + Sys.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All rendering is done in here
|
||||
*/
|
||||
private static void render() {
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
|
||||
GL11.glRotatef(angle, 0, 0, 1.0f);
|
||||
|
||||
|
||||
ByteBuffer new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,
|
||||
ARBBufferObject.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 = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,
|
||||
ARBBufferObject.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 ( ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) &&
|
||||
ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB) ) {
|
||||
GL11.glDrawElements(GL11.GL_QUADS, 4, GL11.GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
private static void init() throws Exception {
|
||||
Sys.setTime(0);
|
||||
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
|
||||
System.out.println("Timer resolution: " + Sys.getTimerResolution());
|
||||
// Go into orthographic projection mode.
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight());
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
|
||||
if ( !GLContext.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();
|
||||
ARBBufferObject.glGenBuffersARB(int_buffer);
|
||||
buffer_id = int_buffer.get(0);
|
||||
indices_buffer_id = int_buffer.get(1);
|
||||
ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, buffer_id);
|
||||
ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.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();
|
||||
ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,
|
||||
2 * 4 * 4,
|
||||
(ByteBuffer)null,
|
||||
ARBBufferObject.GL_STREAM_DRAW_ARB);
|
||||
ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB,
|
||||
4 * 4,
|
||||
(ByteBuffer)null,
|
||||
ARBBufferObject.GL_STREAM_DRAW_ARB);
|
||||
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
GL11.glVertexPointer(2, GL11.GL_FLOAT, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
ARBBufferObject.glDeleteBuffersARB(int_buffer);
|
||||
Window.destroy();
|
||||
try {
|
||||
Display.resetDisplayMode();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,39 +41,37 @@
|
|||
|
||||
package org.lwjgl.test.opengl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.lwjgl.Display;
|
||||
import org.lwjgl.DisplayMode;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.ARBVertexBufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.opengl.Window;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.lwjgl.opengl.glu.GLU;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
public final class VBOTest {
|
||||
|
||||
static {
|
||||
try {
|
||||
//find first display mode that allows us 640*480*16
|
||||
//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) {
|
||||
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) {
|
||||
if ( mode != -1 ) {
|
||||
//select above found displaymode
|
||||
System.out.println("Setting display mode to "+modes[mode]);
|
||||
System.out.println("Setting display mode to " + modes[mode]);
|
||||
Display.setDisplayMode(modes[mode]);
|
||||
System.out.println("Created display.");
|
||||
}
|
||||
|
@ -81,133 +79,143 @@ public final class VBOTest {
|
|||
System.err.println("Failed to create display due to " + e);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
Window.create("LWJGL Game Example", 16, 0, 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;
|
||||
|
||||
static {
|
||||
try {
|
||||
Window.create("LWJGL Game Example", 16, 0, 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 FloatBuffer vertices;
|
||||
private static ByteBuffer mapped_buffer = null;
|
||||
private static FloatBuffer mapped_float_buffer = null;
|
||||
|
||||
public static void main(String[] arguments) {
|
||||
try {
|
||||
init();
|
||||
while (!finished) {
|
||||
Window.update();
|
||||
|
||||
if (Window.isMinimized())
|
||||
Thread.sleep(200);
|
||||
else if (Window.isCloseRequested())
|
||||
System.exit(0);
|
||||
|
||||
mainLoop();
|
||||
render();
|
||||
}
|
||||
} 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;
|
||||
|
||||
if (Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0)
|
||||
System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel());
|
||||
for (int i = 0; i < Mouse.getButtonCount(); i++)
|
||||
if (Mouse.isButtonDown(i))
|
||||
System.out.println("Button " + i + " down");
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
|
||||
finished = true;
|
||||
for (int i = 0; i < Keyboard.getNumKeyboardEvents(); i++) {
|
||||
Keyboard.next();
|
||||
if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState())
|
||||
finished = true;
|
||||
if (Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState())
|
||||
System.out.println("Current time: " + Sys.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All rendering is done in here
|
||||
*/
|
||||
private static void render() {
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
|
||||
GL11.glRotatef(angle, 0, 0, 1.0f);
|
||||
ByteBuffer new_mapped_buffer = ARBVertexBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, ARBVertexBufferObject.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;
|
||||
mapped_float_buffer.rewind();
|
||||
vertices.rewind();
|
||||
mapped_float_buffer.put(vertices);
|
||||
if (ARBVertexBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB))
|
||||
GL11.glDrawArrays(GL11.GL_QUADS, 0, 4);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
private static void init() throws Exception {
|
||||
Sys.setTime(0);
|
||||
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
|
||||
System.out.println("Timer resolution: " + Sys.getTimerResolution());
|
||||
// Go into orthographic projection mode.
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight());
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
|
||||
if (!GLContext.GL_ARB_vertex_buffer_object) {
|
||||
System.out.println("ARB VBO not supported!");
|
||||
System.exit(1);
|
||||
|
||||
public static void main(String[] arguments) {
|
||||
try {
|
||||
init();
|
||||
while ( !finished ) {
|
||||
Window.update();
|
||||
|
||||
if ( Window.isMinimized() )
|
||||
Thread.sleep(200);
|
||||
else if ( Window.isCloseRequested() )
|
||||
System.exit(0);
|
||||
|
||||
mainLoop();
|
||||
render();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
ARBVertexBufferObject.glGenBuffersARB(int_buffer);
|
||||
buffer_id = int_buffer.get(0);
|
||||
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 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);
|
||||
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 2*4*4, (ByteBuffer)null, ARBVertexBufferObject.GL_STREAM_DRAW_ARB);
|
||||
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
GL11.glVertexPointer(2, GL11.GL_FLOAT, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup
|
||||
*/
|
||||
private static void cleanup() {
|
||||
IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
int_buffer.put(0, buffer_id);
|
||||
ARBVertexBufferObject.glDeleteBuffersARB(int_buffer);
|
||||
Window.destroy();
|
||||
try {
|
||||
Display.resetDisplayMode();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All calculations are done in here
|
||||
*/
|
||||
private static void mainLoop() {
|
||||
angle += 1f;
|
||||
if ( angle > 360.0f )
|
||||
angle = 0.0f;
|
||||
|
||||
if ( Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0 )
|
||||
System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel());
|
||||
for ( int i = 0; i < Mouse.getButtonCount(); i++ )
|
||||
if ( Mouse.isButtonDown(i) )
|
||||
System.out.println("Button " + i + " down");
|
||||
if ( Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) )
|
||||
finished = true;
|
||||
for ( int i = 0; i < Keyboard.getNumKeyboardEvents(); i++ ) {
|
||||
Keyboard.next();
|
||||
if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState() )
|
||||
finished = true;
|
||||
if ( Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState() )
|
||||
System.out.println("Current time: " + Sys.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All rendering is done in here
|
||||
*/
|
||||
private static void render() {
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
|
||||
GL11.glRotatef(angle, 0, 0, 1.0f);
|
||||
ByteBuffer new_mapped_buffer = ARBBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,
|
||||
ARBBufferObject.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;
|
||||
mapped_float_buffer.rewind();
|
||||
vertices.rewind();
|
||||
mapped_float_buffer.put(vertices);
|
||||
if ( ARBBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB) )
|
||||
GL11.glDrawArrays(GL11.GL_QUADS, 0, 4);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
private static void init() throws Exception {
|
||||
Sys.setTime(0);
|
||||
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
|
||||
System.out.println("Timer resolution: " + Sys.getTimerResolution());
|
||||
// Go into orthographic projection mode.
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight());
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
|
||||
if ( !GLContext.GL_ARB_vertex_buffer_object ) {
|
||||
System.out.println("ARB VBO not supported!");
|
||||
System.exit(1);
|
||||
}
|
||||
IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
ARBBufferObject.glGenBuffersARB(int_buffer);
|
||||
buffer_id = int_buffer.get(0);
|
||||
ARBBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 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);
|
||||
ARBBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB,
|
||||
2 * 4 * 4,
|
||||
(ByteBuffer)null,
|
||||
ARBBufferObject.GL_STREAM_DRAW_ARB);
|
||||
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
GL11.glVertexPointer(2, GL11.GL_FLOAT, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup
|
||||
*/
|
||||
private static void cleanup() {
|
||||
IntBuffer int_buffer = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
int_buffer.put(0, buffer_id);
|
||||
ARBBufferObject.glDeleteBuffersARB(int_buffer);
|
||||
Window.destroy();
|
||||
try {
|
||||
Display.resetDisplayMode();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@ noinst_LTLIBRARIES = libarb.la
|
|||
|
||||
libarb_la_SOURCES = $(SRC)
|
||||
INCLUDES=-I..
|
||||
SRC = org_lwjgl_opengl_ARBProgram.cpp \
|
||||
SRC = org_lwjgl_opengl_ARBBufferObject.cpp \
|
||||
org_lwjgl_opengl_ARBProgram.cpp \
|
||||
org_lwjgl_opengl_ARBProgram.cpp \
|
||||
org_lwjgl_opengl_ARBMatrixPalette.cpp \
|
||||
org_lwjgl_opengl_ARBMultisample.cpp \
|
||||
|
@ -12,7 +13,6 @@ SRC = org_lwjgl_opengl_ARBProgram.cpp \
|
|||
org_lwjgl_opengl_ARBTextureCompression.cpp \
|
||||
org_lwjgl_opengl_ARBTransposeMatrix.cpp \
|
||||
org_lwjgl_opengl_ARBVertexBlend.cpp \
|
||||
org_lwjgl_opengl_ARBVertexBufferObject.cpp \
|
||||
org_lwjgl_opengl_ARBVertexProgram.cpp \
|
||||
org_lwjgl_opengl_ARBWindowPos.cpp \
|
||||
org_lwjgl_opengl_ARBOcclusionQuery.cpp \
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
// ----------------------------------
|
||||
// IMPLEMENTATION OF NATIVE METHODS FOR CLASS: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
// IMPLEMENTATION OF NATIVE METHODS FOR CLASS: org.lwjgl.opengl.ARBBufferObject
|
||||
// ----------------------------------
|
||||
|
||||
#include "extgl.h"
|
||||
|
@ -65,21 +65,20 @@ static glGetBufferParameterivARBPROC glGetBufferParameterivARB;
|
|||
static glGetBufferPointervARBPROC glGetBufferPointervARB;
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: nglBindBufferARB
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglBindBufferARB
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBBufferObject_nglBindBufferARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint buffer)
|
||||
{
|
||||
glBindBufferARB(target, buffer);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: nglDeleteBuffersARB
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglDeleteBuffersARB
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBBufferObject_nglDeleteBuffersARB
|
||||
(JNIEnv * env, jclass clazz, jint n, jobject buffers, jint buffers_offset)
|
||||
{
|
||||
GLuint *buffers_ptr = (GLuint *)env->GetDirectBufferAddress(buffers) + buffers_offset;
|
||||
|
@ -88,10 +87,10 @@ static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglDeleteBuffers
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: nglGenBuffersARB
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGenBuffersARB
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBBufferObject_nglGenBuffersARB
|
||||
(JNIEnv * env, jclass clazz, jint n, jobject buffers, jint buffers_offset)
|
||||
{
|
||||
GLuint *buffers_ptr = (GLuint *)env->GetDirectBufferAddress(buffers) + buffers_offset;
|
||||
|
@ -100,10 +99,10 @@ static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGenBuffersARB
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: glIsBufferARB
|
||||
*/
|
||||
static jboolean JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_glIsBufferARB
|
||||
static jboolean JNICALL Java_org_lwjgl_opengl_ARBBufferObject_glIsBufferARB
|
||||
(JNIEnv * env, jclass clazz, jint buffer)
|
||||
{
|
||||
GLboolean result = glIsBufferARB(buffer);
|
||||
|
@ -112,10 +111,10 @@ static jboolean JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_glIsBufferAR
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: nglBufferDataARB
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglBufferDataARB
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBBufferObject_nglBufferDataARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint size, jobject data, jint data_offset, jint usage)
|
||||
{
|
||||
GLvoid *data_ptr = (GLvoid *)safeGetBufferAddress(env, data, data_offset);
|
||||
|
@ -124,10 +123,10 @@ static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglBufferDataARB
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: nglBufferSubDataARB
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglBufferSubDataARB
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBBufferObject_nglBufferSubDataARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint offset, jint size, jobject data, jint data_offset)
|
||||
{
|
||||
GLvoid *data_ptr = (GLvoid *)((GLubyte *)env->GetDirectBufferAddress(data) + data_offset);
|
||||
|
@ -136,10 +135,10 @@ static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglBufferSubData
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: nglGetBufferSubDataARB
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGetBufferSubDataARB
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBBufferObject_nglGetBufferSubDataARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint offset, jint size, jobject data, jint data_offset)
|
||||
{
|
||||
GLvoid *data_ptr = (GLvoid *)((GLubyte *)env->GetDirectBufferAddress(data) + data_offset);
|
||||
|
@ -148,10 +147,10 @@ static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGetBufferSubD
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: glMapBufferARB
|
||||
*/
|
||||
static jobject JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_glMapBufferARB
|
||||
static jobject JNICALL Java_org_lwjgl_opengl_ARBBufferObject_glMapBufferARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint access, jint size, jobject oldBuffer)
|
||||
{
|
||||
void *buffer_address = glMapBufferARB((GLenum)target, (GLenum)access);
|
||||
|
@ -164,10 +163,10 @@ static jobject JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_glMapBufferAR
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: glUnmapBufferARB
|
||||
*/
|
||||
static jboolean JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_glUnmapBufferARB
|
||||
static jboolean JNICALL Java_org_lwjgl_opengl_ARBBufferObject_glUnmapBufferARB
|
||||
(JNIEnv * env, jclass clazz, jint target)
|
||||
{
|
||||
GLboolean result = glUnmapBufferARB(target);
|
||||
|
@ -176,10 +175,10 @@ static jboolean JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_glUnmapBuffe
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: nglGetBufferParameterivARB
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGetBufferParameterivARB
|
||||
static void JNICALL Java_org_lwjgl_opengl_ARBBufferObject_nglGetBufferParameterivARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint pname, jobject params, jint params_offset)
|
||||
{
|
||||
GLint *params_ptr = (GLint *)env->GetDirectBufferAddress(params) + params_offset;
|
||||
|
@ -188,10 +187,10 @@ static void JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGetBufferPara
|
|||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.ARBVertexBufferObject
|
||||
* Class: org.lwjgl.opengl.ARBBufferObject
|
||||
* Method: glGetBufferPointerARB
|
||||
*/
|
||||
static jobject JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_glGetBufferPointerARB
|
||||
static jobject JNICALL Java_org_lwjgl_opengl_ARBBufferObject_glGetBufferPointerARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint pname, jint size)
|
||||
{
|
||||
void *pointer;
|
||||
|
@ -200,24 +199,24 @@ static jobject JNICALL Java_org_lwjgl_opengl_ARBVertexBufferObject_glGetBufferPo
|
|||
return safeNewBuffer(env, pointer, size);
|
||||
}
|
||||
|
||||
void extgl_InitARBVertexBufferObject(JNIEnv *env, jobject ext_set)
|
||||
void extgl_InitARBBufferObject(JNIEnv *env, jobject ext_set)
|
||||
{
|
||||
JavaMethodAndExtFunction functions[] = {
|
||||
{"nglBindBufferARB", "(II)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_nglBindBufferARB, "glBindBufferARB", (void**)&glBindBufferARB},
|
||||
{"nglDeleteBuffersARB", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_nglDeleteBuffersARB, "glDeleteBuffersARB", (void**)&glDeleteBuffersARB},
|
||||
{"nglGenBuffersARB", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGenBuffersARB, "glGenBuffersARB", (void**)&glGenBuffersARB},
|
||||
{"glIsBufferARB", "(I)Z", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_glIsBufferARB, "glIsBufferARB", (void**)&glIsBufferARB},
|
||||
{"nglBufferDataARB", "(IILjava/nio/Buffer;II)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_nglBufferDataARB, "glBufferDataARB", (void**)&glBufferDataARB},
|
||||
{"nglBufferSubDataARB", "(IIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_nglBufferSubDataARB, "glBufferSubDataARB", (void**)&glBufferSubDataARB},
|
||||
{"nglGetBufferSubDataARB", "(IIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGetBufferSubDataARB, "glGetBufferSubDataARB", (void**)&glGetBufferSubDataARB},
|
||||
{"glMapBufferARB", "(IIILjava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_glMapBufferARB, "glMapBufferARB", (void**)&glMapBufferARB},
|
||||
{"glUnmapBufferARB", "(I)Z", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_glUnmapBufferARB, "glUnmapBufferARB", (void**)&glUnmapBufferARB},
|
||||
{"nglGetBufferParameterivARB", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_nglGetBufferParameterivARB, "glGetBufferParameterivARB", (void**)&glGetBufferParameterivARB},
|
||||
{"glGetBufferPointerARB", "(III)Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_opengl_ARBVertexBufferObject_glGetBufferPointerARB, "glGetBufferPointervARB", (void**)&glGetBufferPointervARB}
|
||||
{"nglBindBufferARB", "(II)V", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_nglBindBufferARB, "glBindBufferARB", (void**)&glBindBufferARB},
|
||||
{"nglDeleteBuffersARB", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_nglDeleteBuffersARB, "glDeleteBuffersARB", (void**)&glDeleteBuffersARB},
|
||||
{"nglGenBuffersARB", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_nglGenBuffersARB, "glGenBuffersARB", (void**)&glGenBuffersARB},
|
||||
{"glIsBufferARB", "(I)Z", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_glIsBufferARB, "glIsBufferARB", (void**)&glIsBufferARB},
|
||||
{"nglBufferDataARB", "(IILjava/nio/Buffer;II)V", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_nglBufferDataARB, "glBufferDataARB", (void**)&glBufferDataARB},
|
||||
{"nglBufferSubDataARB", "(IIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_nglBufferSubDataARB, "glBufferSubDataARB", (void**)&glBufferSubDataARB},
|
||||
{"nglGetBufferSubDataARB", "(IIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_nglGetBufferSubDataARB, "glGetBufferSubDataARB", (void**)&glGetBufferSubDataARB},
|
||||
{"glMapBufferARB", "(IIILjava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_glMapBufferARB, "glMapBufferARB", (void**)&glMapBufferARB},
|
||||
{"glUnmapBufferARB", "(I)Z", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_glUnmapBufferARB, "glUnmapBufferARB", (void**)&glUnmapBufferARB},
|
||||
{"nglGetBufferParameterivARB", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_nglGetBufferParameterivARB, "glGetBufferParameterivARB", (void**)&glGetBufferParameterivARB},
|
||||
{"glGetBufferPointerARB", "(III)Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_opengl_ARBBufferObject_glGetBufferPointerARB, "glGetBufferPointervARB", (void**)&glGetBufferPointervARB}
|
||||
};
|
||||
int num_functions = NUMFUNCTIONS(functions);
|
||||
jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBVertexBufferObject");
|
||||
if (extgl_Extensions.GL_ARB_vertex_buffer_object)
|
||||
extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_vertex_buffer_object", num_functions, functions);
|
||||
}
|
||||
|
||||
int num_functions = NUMFUNCTIONS(functions);
|
||||
jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBBufferObject");
|
||||
|
||||
extgl_InitializeClass(env, clazz, NULL, "<ARBBufferObject>", num_functions, functions);
|
||||
}
|
|
@ -4,6 +4,7 @@ libext_la_SOURCES = $(SRC)
|
|||
INCLUDES=-I..
|
||||
SRC=org_lwjgl_opengl_EXTBlendFuncSeparate.cpp \
|
||||
org_lwjgl_opengl_EXTCompiledVertexArray.cpp \
|
||||
org_lwjgl_opengl_EXTDepthBoundsTest.cpp \
|
||||
org_lwjgl_opengl_EXTDrawRangeElements.cpp \
|
||||
org_lwjgl_opengl_EXTFogCoord.cpp \
|
||||
org_lwjgl_opengl_EXTMultiDrawArrays.cpp \
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// ----------------------------------
|
||||
// IMPLEMENTATION OF NATIVE METHODS FOR CLASS: org.lwjgl.opengl.EXTDepthBoundsTest
|
||||
// ----------------------------------
|
||||
|
||||
#include "extgl.h"
|
||||
|
||||
typedef void (APIENTRY * glDepthBoundsEXTPROC) (GLclampd zmin, GLclampd zmax);
|
||||
|
||||
static glDepthBoundsEXTPROC glDepthBoundsEXT;
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.EXTDepthBoundsTest
|
||||
* Method: glDepthBoundsEXT
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_EXTDepthBoundsTest_glDepthBoundsEXT
|
||||
(JNIEnv * env, jclass clazz, jfloat zmin, jfloat zmax)
|
||||
{
|
||||
glDepthBoundsEXT(zmin, zmax);
|
||||
}
|
||||
|
||||
void extgl_InitEXTDepthBoundsTest(JNIEnv *env, jobject ext_set)
|
||||
{
|
||||
JavaMethodAndExtFunction functions[] = {
|
||||
{"glDepthBoundsEXT", "(FF)V", (void*)&Java_org_lwjgl_opengl_EXTDepthBoundsTest_glDepthBoundsEXT, "glDepthBoundsEXT", (void**)&glDepthBoundsEXT}
|
||||
};
|
||||
int num_functions = NUMFUNCTIONS(functions);
|
||||
jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTDepthBoundsTest");
|
||||
if (extgl_Extensions.GL_EXT_depth_bounds_test)
|
||||
extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_depth_bounds_test", num_functions, functions);
|
||||
}
|
|
@ -545,8 +545,6 @@ static void extgl_InitSupportedExtensions(JNIEnv *env, jobject ext_set)
|
|||
}
|
||||
}
|
||||
|
||||
extgl_Extensions.GL_ARB_depth_texture = GLQueryExtension(env, ext_set, "GL_ARB_depth_texture");
|
||||
|
||||
extgl_Extensions.GL_ARB_imaging = GLQueryExtension(env, ext_set, "GL_ARB_imaging");
|
||||
extgl_Extensions.GL_ARB_depth_texture = GLQueryExtension(env, ext_set, "GL_ARB_depth_texture");
|
||||
extgl_Extensions.GL_ARB_fragment_program = GLQueryExtension(env, ext_set, "GL_ARB_fragment_program");
|
||||
|
@ -582,11 +580,14 @@ static void extgl_InitSupportedExtensions(JNIEnv *env, jobject ext_set)
|
|||
extgl_Extensions.GL_EXT_bgra = GLQueryExtension(env, ext_set, "GL_EXT_bgra");
|
||||
extgl_Extensions.GL_EXT_blend_func_separate = GLQueryExtension(env, ext_set, "GL_EXT_blend_func_separate");
|
||||
extgl_Extensions.GL_EXT_blend_subtract = GLQueryExtension(env, ext_set, "GL_EXT_blend_subtract");
|
||||
extgl_Extensions.GL_EXT_Cg_shader = GLQueryExtension(env, ext_set, "GL_EXT_Cg_shader");
|
||||
extgl_Extensions.GL_EXT_compiled_vertex_array = GLQueryExtension(env, ext_set, "GL_EXT_compiled_vertex_array");
|
||||
extgl_Extensions.GL_EXT_depth_bounds_test = GLQueryExtension(env, ext_set, "GL_EXT_depth_bounds_test");
|
||||
extgl_Extensions.GL_EXT_draw_range_elements = GLQueryExtension(env, ext_set, "GL_EXT_draw_range_elements");
|
||||
extgl_Extensions.GL_EXT_fog_coord = GLQueryExtension(env, ext_set, "GL_EXT_fog_coord");
|
||||
extgl_Extensions.GL_EXT_multi_draw_arrays = GLQueryExtension(env, ext_set, "GL_EXT_multi_draw_arrays");
|
||||
extgl_Extensions.GL_EXT_packed_pixels = GLQueryExtension(env, ext_set, "GL_EXT_packed_pixels");
|
||||
extgl_Extensions.GL_EXT_pixel_buffer_object = GLQueryExtension(env, ext_set, "GL_EXT_pixel_buffer_object");
|
||||
extgl_Extensions.GL_EXT_point_parameters = GLQueryExtension(env, ext_set, "GL_EXT_point_parameters");
|
||||
extgl_Extensions.GL_EXT_rescale_normal = GLQueryExtension(env, ext_set, "GL_EXT_rescale_normal");
|
||||
extgl_Extensions.GL_EXT_secondary_color = GLQueryExtension(env, ext_set, "GL_EXT_secondary_color");
|
||||
|
@ -625,6 +626,7 @@ static void extgl_InitSupportedExtensions(JNIEnv *env, jobject ext_set)
|
|||
extgl_Extensions.GL_NV_float_buffer = GLQueryExtension(env, ext_set, "GL_NV_float_buffer");
|
||||
extgl_Extensions.GL_NV_fog_distance = GLQueryExtension(env, ext_set, "GL_NV_fog_distance");
|
||||
extgl_Extensions.GL_NV_fragment_program = GLQueryExtension(env, ext_set, "GL_NV_fragment_program");
|
||||
extgl_Extensions.GL_NV_fragment_program_option = GLQueryExtension(env, ext_set, "GL_NV_fragment_program_option");
|
||||
extgl_Extensions.GL_NV_half_float = GLQueryExtension(env, ext_set, "GL_NV_half_float");
|
||||
extgl_Extensions.GL_NV_light_max_exponent = GLQueryExtension(env, ext_set, "GL_NV_light_max_exponent");
|
||||
extgl_Extensions.GL_NV_multisample_filter_hint = GLQueryExtension(env, ext_set, "GL_NV_multisample_filter_hint");
|
||||
|
@ -648,10 +650,12 @@ static void extgl_InitSupportedExtensions(JNIEnv *env, jobject ext_set)
|
|||
extgl_Extensions.GL_NV_vertex_program = GLQueryExtension(env, ext_set, "GL_NV_vertex_program");
|
||||
extgl_Extensions.GL_NV_vertex_program1_1 = GLQueryExtension(env, ext_set, "GL_NV_vertex_program1_1");
|
||||
extgl_Extensions.GL_NV_vertex_program2 = GLQueryExtension(env, ext_set, "GL_NV_vertex_program2");
|
||||
extgl_Extensions.GL_NV_vertex_program2_option = GLQueryExtension(env, ext_set, "GL_NV_vertex_program2_option");
|
||||
}
|
||||
|
||||
extern bool extgl_InitOpenGL1_1(JNIEnv *env);
|
||||
//extern void extgl_InitARBFragmentProgram(JNIEnv *env, jobject ext_set);
|
||||
|
||||
extern void extgl_InitARBBufferObject(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBImaging(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBMatrixPalette(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBMultisample(JNIEnv *env, jobject ext_set);
|
||||
|
@ -663,13 +667,13 @@ extern void extgl_InitARBShaderObjects(JNIEnv *env, jobject ext_set);
|
|||
extern void extgl_InitARBTextureCompression(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBTransposeMatrix(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBVertexBlend(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBVertexBufferObject(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBVertexProgram(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBVertexShader(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitARBWindowPos(JNIEnv *env, jobject ext_set);
|
||||
|
||||
extern void extgl_InitEXTBlendFuncSeparate(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitEXTCompiledVertexArray(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitEXTDepthBoundsTest(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitEXTDrawRangeElements(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitEXTFogCoord(JNIEnv *env, jobject ext_set);
|
||||
extern void extgl_InitEXTMultiDrawArrays(JNIEnv *env, jobject ext_set);
|
||||
|
@ -722,7 +726,7 @@ bool extgl_Initialize(JNIEnv *env, jobject ext_set)
|
|||
//extgl_InitEXTNurbsTesselator(env, ext_set);
|
||||
|
||||
/* first load the extensions */
|
||||
// extgl_InitARBFragmentProgram(env, ext_set);
|
||||
extgl_InitARBBufferObject(env, ext_set);
|
||||
extgl_InitARBImaging(env, ext_set);
|
||||
extgl_InitARBMatrixPalette(env, ext_set);
|
||||
extgl_InitARBMultisample(env, ext_set);
|
||||
|
@ -734,14 +738,13 @@ bool extgl_Initialize(JNIEnv *env, jobject ext_set)
|
|||
extgl_InitARBTextureCompression(env, ext_set);
|
||||
extgl_InitARBTransposeMatrix(env, ext_set);
|
||||
extgl_InitARBVertexBlend(env, ext_set);
|
||||
extgl_InitARBVertexBufferObject(env, ext_set);
|
||||
extgl_InitARBVertexProgram(env, ext_set);
|
||||
extgl_InitARBVertexShader(env, ext_set);
|
||||
extgl_InitARBWindowPos(env, ext_set);
|
||||
|
||||
extgl_InitEXTBlendFuncSeparate(env, ext_set);
|
||||
extgl_InitEXTCompiledVertexArray(env, ext_set);
|
||||
//extgl_InitEXTCullVertex(env, ext_set);
|
||||
extgl_InitEXTDepthBoundsTest(env, ext_set);
|
||||
extgl_InitEXTDrawRangeElements(env, ext_set);
|
||||
extgl_InitEXTFogCoord(env, ext_set);
|
||||
extgl_InitEXTMultiDrawArrays(env, ext_set);
|
||||
|
@ -751,7 +754,6 @@ bool extgl_Initialize(JNIEnv *env, jobject ext_set)
|
|||
extgl_InitEXTVertexShader(env, ext_set);
|
||||
extgl_InitEXTVertexWeighting(env, ext_set);
|
||||
|
||||
//extgl_InitNVElementArray(env, ext_set);
|
||||
extgl_InitNVEvaluators(env, ext_set);
|
||||
extgl_InitNVFence(env, ext_set);
|
||||
extgl_InitNVFragmentProgram(env, ext_set);
|
||||
|
|
|
@ -2088,11 +2088,14 @@ struct ExtensionTypes
|
|||
bool GL_EXT_bgra;
|
||||
bool GL_EXT_blend_func_separate;
|
||||
bool GL_EXT_blend_subtract;
|
||||
bool GL_EXT_Cg_shader;
|
||||
bool GL_EXT_compiled_vertex_array;
|
||||
bool GL_EXT_depth_bounds_test;
|
||||
bool GL_EXT_draw_range_elements;
|
||||
bool GL_EXT_fog_coord;
|
||||
bool GL_EXT_multi_draw_arrays;
|
||||
bool GL_EXT_packed_pixels;
|
||||
bool GL_EXT_pixel_buffer_object;
|
||||
bool GL_EXT_point_parameters;
|
||||
bool GL_EXT_rescale_normal;
|
||||
bool GL_EXT_secondary_color;
|
||||
|
@ -2131,6 +2134,7 @@ struct ExtensionTypes
|
|||
bool GL_NV_float_buffer;
|
||||
bool GL_NV_fog_distance;
|
||||
bool GL_NV_fragment_program;
|
||||
bool GL_NV_fragment_program_option;
|
||||
bool GL_NV_half_float;
|
||||
bool GL_NV_light_max_exponent;
|
||||
bool GL_NV_multisample_filter_hint;
|
||||
|
@ -2154,6 +2158,7 @@ struct ExtensionTypes
|
|||
bool GL_NV_vertex_program;
|
||||
bool GL_NV_vertex_program1_1;
|
||||
bool GL_NV_vertex_program2;
|
||||
bool GL_NV_vertex_program2_option;
|
||||
};
|
||||
|
||||
extern struct ExtensionTypes extgl_Extensions;
|
||||
|
|
|
@ -36,16 +36,11 @@
|
|||
|
||||
#include "extgl.h"
|
||||
|
||||
|
||||
typedef void (APIENTRY * glProgramNamedParameter4fNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRY * glProgramLocalParameter4fARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRY * glGetProgramNamedParameterfvNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
|
||||
typedef void (APIENTRY * glGetProgramLocalParameterfvARBPROC) (GLenum target, GLuint index, GLfloat *params);
|
||||
|
||||
static glProgramNamedParameter4fNVPROC glProgramNamedParameter4fNV;
|
||||
static glProgramLocalParameter4fARBPROC glProgramLocalParameter4fARB;
|
||||
static glGetProgramNamedParameterfvNVPROC glGetProgramNamedParameterfvNV;
|
||||
static glGetProgramLocalParameterfvARBPROC glGetProgramLocalParameterfvARB;
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.NVFragmentProgram
|
||||
|
@ -56,7 +51,6 @@ static void JNICALL Java_org_lwjgl_opengl_NVFragmentProgram_nglProgramNamedParam
|
|||
{
|
||||
GLubyte *name_ptr = (GLubyte *)env->GetDirectBufferAddress(name) + nameOffset;
|
||||
glProgramNamedParameter4fNV(id, length, name_ptr, x, y, z, w);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -69,30 +63,6 @@ static void JNICALL Java_org_lwjgl_opengl_NVFragmentProgram_nglGetProgramNamedPa
|
|||
GLubyte *name_ptr = (GLubyte *)env->GetDirectBufferAddress(name) + nameOffset;
|
||||
GLfloat *params_ptr = (GLfloat *)env->GetDirectBufferAddress(params) + paramsOffset;
|
||||
glGetProgramNamedParameterfvNV(id, length, name_ptr, params_ptr);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.NVFragmentProgram
|
||||
* Method: glProgramLocalParameter4fNV
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_NVFragmentProgram_glProgramLocalParameter4fARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint index, jfloat x, jfloat y, jfloat z, jfloat w)
|
||||
{
|
||||
glProgramLocalParameter4fARB(target, index, x, y, z, w);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org.lwjgl.opengl.NVFragmentProgram
|
||||
* Method: nglGetProgramLocalParameterfvNV
|
||||
*/
|
||||
static void JNICALL Java_org_lwjgl_opengl_NVFragmentProgram_nglGetProgramLocalParameterfvARB
|
||||
(JNIEnv * env, jclass clazz, jint target, jint index, jobject params, jint params_offset)
|
||||
{
|
||||
GLfloat *params_ptr = (GLfloat *)env->GetDirectBufferAddress(params) + params_offset;
|
||||
glGetProgramLocalParameterfvARB(target, index, params_ptr);
|
||||
|
||||
}
|
||||
|
||||
void extgl_InitNVFragmentProgram(JNIEnv *env, jobject ext_set)
|
||||
|
@ -100,8 +70,6 @@ void extgl_InitNVFragmentProgram(JNIEnv *env, jobject ext_set)
|
|||
JavaMethodAndExtFunction functions[] = {
|
||||
{"nglProgramNamedParameter4fNV", "(IILjava/nio/ByteBuffer;IFFFF)V", (void*)&Java_org_lwjgl_opengl_NVFragmentProgram_nglProgramNamedParameter4fNV, "glProgramNamedParameter4fNV", (void**)&glProgramNamedParameter4fNV},
|
||||
{"nglGetProgramNamedParameterfvNV", "(IILjava/nio/ByteBuffer;ILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVFragmentProgram_nglGetProgramNamedParameterfvNV, "glGetProgramNamedParameterfvNV", (void**)&glGetProgramNamedParameterfvNV},
|
||||
{"glProgramLocalParameter4fARB", "(IIFFFF)V", (void*)&Java_org_lwjgl_opengl_NVFragmentProgram_glProgramLocalParameter4fARB, "glProgramLocalParameter4fARB", (void**)&glProgramLocalParameter4fARB},
|
||||
{"nglGetProgramLocalParameterfvARB", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVFragmentProgram_nglGetProgramLocalParameterfvARB, "glGetProgramLocalParameterfvARB", (void**)&glGetProgramLocalParameterfvARB}
|
||||
};
|
||||
int num_functions = NUMFUNCTIONS(functions);
|
||||
jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVFragmentProgram");
|
||||
|
|
Loading…
Reference in New Issue