The BIG LWJGL REFACTORING

This commit is contained in:
Caspian Rychlik-Prince 2004-02-09 23:37:28 +00:00
parent 84cc336d9d
commit 6917a1e1de
12 changed files with 119 additions and 51 deletions

View File

@ -1,40 +1,33 @@
/*
* Copyright (c) 2002 Lightweight Java Game Library Project
* All rights reserved.
*
* Copyright (c) 2002 Lightweight Java Game Library Project All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * 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.
* 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 zDimensions.
* User: spasi
* Date: 2003-11-28
* Time: 16:41:02
* Created by zDimensions. User: spasi Date: 2003-11-28 Time: 16:41:02
*/
package org.lwjgl.opengl;
@ -42,20 +35,19 @@ package org.lwjgl.opengl;
public class ARBFragmentProgram extends ARBProgram {
/*
* Accepted by the <cap> parameter of Disable, Enable, and IsEnabled,
* by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
* and GetDoublev, and by the <target> parameter of ProgramStringARB,
* BindProgramARB, ProgramEnvParameter4[df][v]ARB,
* ProgramLocalParameter4[df][v]ARB, GetProgramEnvParameter[df]vARB,
* GetProgramLocalParameter[df]vARB, GetProgramivARB and
* GetProgramStringARB.
*/
* Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, by the
* <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev,
* and by the <target> parameter of ProgramStringARB, BindProgramARB,
* ProgramEnvParameter4[df][v]ARB, ProgramLocalParameter4[df][v]ARB,
* GetProgramEnvParameter[df]vARB, GetProgramLocalParameter[df]vARB,
* GetProgramivARB and GetProgramStringARB.
*/
public static final int GL_FRAGMENT_PROGRAM_ARB = 0x8804;
/*
* Accepted by the <pname> parameter of GetProgramivARB:
*/
* Accepted by the <pname> parameter of GetProgramivARB:
*/
public static final int GL_PROGRAM_ALU_INSTRUCTIONS_ARB = 0x8805;
@ -82,12 +74,18 @@ public class ARBFragmentProgram extends ARBProgram {
public static final int GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 0x8810;
/*
* Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
* GetFloatv, and GetDoublev:
*/
* Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
* and GetDoublev:
*/
public static final int GL_MAX_TEXTURE_COORDS_ARB = 0x8871;
public static final int GL_MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872;
static {
BufferChecks.putGetMap(GL_FRAGMENT_PROGRAM_ARB, 1);
BufferChecks.putGetMap(GL_MAX_TEXTURE_COORDS_ARB, 1);
BufferChecks.putGetMap(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, 1);
}
}

View File

@ -38,7 +38,7 @@
package org.lwjgl.opengl;
public interface ARBFragmentShader {
public class ARBFragmentShader {
/*
* Accepted by the <shaderType> argument of CreateShaderObjectARB:
@ -51,4 +51,8 @@ public interface ARBFragmentShader {
*/
public static final int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 0x8B49;
static {
BufferChecks.putGetMap(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, 1);
}
}

View File

@ -57,6 +57,16 @@ public class ARBMatrixPalette {
public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_ARB = 0x8848;
public static final int GL_MATRIX_INDEX_ARRAY_POINTER_ARB = 0x8849;
static {
BufferChecks.putGetMap(GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB, 1);
BufferChecks.putGetMap(GL_MAX_PALETTE_MATRICES_ARB, 1);
BufferChecks.putGetMap(GL_CURRENT_PALETTE_MATRIX_ARB, 1);
BufferChecks.putGetMap(GL_MATRIX_INDEX_ARRAY_SIZE_ARB, 1);
BufferChecks.putGetMap(GL_MATRIX_INDEX_ARRAY_TYPE_ARB, 1);
BufferChecks.putGetMap(GL_MATRIX_INDEX_ARRAY_STRIDE_ARB, 1);
BufferChecks.putGetMap(GL_MATRIX_INDEX_ARRAY_POINTER_ARB, 1); // TODO: figure out what to do with pointers
}
public static native void glCurrentPaletteMatrixARB(int index);
public static void glMatrixIndexPointerARB(int size, int stride, ByteBuffer pPointer) {
BufferChecks.checkVBOdisabled();

View File

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

View File

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

View File

@ -60,7 +60,7 @@ public class ARBOcclusionQuery {
*/
public static final int GL_QUERY_RESULT_ARB = 0x8866;
public static final int GL_QUERY_RESULT_AVAILABLE_ARB = 0x8867;
// ---------------------------
public static void glGenQueriesARB(IntBuffer ids) {
nglGenQueriesARB(ids.remaining(), ids, ids.position());

View File

@ -47,6 +47,13 @@ public class ARBPointParameters {
public static final int GL_POINT_FADE_THRESHOLD_SIZE_ARB = 0x8128;
public static final int GL_POINT_DISTANCE_ATTENUATION_ARB = 0x8129;
static {
BufferChecks.putGetMap(GL_POINT_SIZE_MIN_ARB, 1);
BufferChecks.putGetMap(GL_POINT_SIZE_MAX_ARB, 1);
BufferChecks.putGetMap(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1);
BufferChecks.putGetMap(GL_POINT_DISTANCE_ATTENUATION_ARB, 3);
}
public static native void glPointParameterfARB(int pname, float param);
public static void glPointParameterARB(int pname, FloatBuffer pfParams) {

View File

@ -7,7 +7,7 @@
package org.lwjgl.opengl;
public interface ARBPointSprite {
public class ARBPointSprite {
/*
* Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
@ -15,7 +15,7 @@ public interface ARBPointSprite {
* GetDoublev, and by the <target> parameter of TexEnvi, TexEnviv,
* TexEnvf, TexEnvfv, GetTexEnviv, and GetTexEnvfv:
*/
public static final int POINT_SPRITE_ARB = 0x8861;
public static final int GL_POINT_SPRITE_ARB = 0x8861;
/*
* When the <target> parameter of TexEnvf, TexEnvfv, TexEnvi, TexEnviv,
@ -23,6 +23,9 @@ public interface ARBPointSprite {
* <pname> may be:
*/
public static final int COORD_REPLACE_ARB = 0x8862;
public static final int GL_COORD_REPLACE_ARB = 0x8862;
static {
BufferChecks.putGetMap(GL_POINT_SPRITE_ARB, 1);
}
}

View File

@ -133,6 +133,15 @@ class ARBProgram {
public static final int GL_MATRIX29_ARB = 0x88DD;
public static final int GL_MATRIX30_ARB = 0x88DE;
public static final int GL_MATRIX31_ARB = 0x88DF;
static {
BufferChecks.putGetMap(GL_PROGRAM_ERROR_POSITION_ARB, 1);
BufferChecks.putGetMap(GL_CURRENT_MATRIX_ARB, 1);
BufferChecks.putGetMap(GL_TRANSPOSE_CURRENT_MATRIX_ARB, 1);
BufferChecks.putGetMap(GL_CURRENT_MATRIX_STACK_DEPTH_ARB, 1);
BufferChecks.putGetMap(GL_MAX_PROGRAM_MATRICES_ARB, 1);
BufferChecks.putGetMap(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
}
// ---------------------------
public static void glProgramStringARB(int target, int format, ByteBuffer string) {

View File

@ -59,6 +59,12 @@ public class ARBTextureCompression
public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A2;
public static final int GL_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A3;
static {
BufferChecks.putGetMap(GL_TEXTURE_COMPRESSION_HINT_ARB, 1);
BufferChecks.putGetMap(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, 1);
BufferChecks.putGetMap(GL_COMPRESSED_TEXTURE_FORMATS_ARB, 1);
}
public static void glCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, ByteBuffer pData) {
// TODO: Check buffer size
nglCompressedTexImage1DARB(target, level, internalformat, width, border, imageSize, pData, pData.position());

View File

@ -39,7 +39,7 @@
*/
package org.lwjgl.opengl;
public class ARBCubeMap {
public class ARBTextureCubeMap {
public static final int GL_NORMAL_MAP_ARB = 0x8511;
public static final int GL_REFLECTION_MAP_ARB = 0x8512;
public static final int GL_TEXTURE_CUBE_MAP_ARB = 0x8513;
@ -52,4 +52,11 @@ public class ARBCubeMap {
public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 0x851A;
public static final int GL_PROXY_TEXTURE_CUBE_MAP_ARB = 0x851B;
public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB = 0x851C;
static {
BufferChecks.putGetMap(GL_TEXTURE_BINDING_CUBE_MAP_ARB, 1);
BufferChecks.putGetMap(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, 1);
}
}

View File

@ -48,6 +48,13 @@ public class ARBTransposeMatrix {
public static final int GL_TRANSPOSE_TEXTURE_MATRIX_ARB = 0x84E5;
public static final int GL_TRANSPOSE_COLOR_MATRIX_ARB = 0x84E6;
static {
BufferChecks.putGetMap(GL_TRANSPOSE_MODELVIEW_MATRIX_ARB, 16);
BufferChecks.putGetMap(GL_TRANSPOSE_PROJECTION_MATRIX_ARB, 16);
BufferChecks.putGetMap(GL_TRANSPOSE_TEXTURE_MATRIX_ARB, 16);
BufferChecks.putGetMap(GL_TRANSPOSE_COLOR_MATRIX_ARB, 16);
}
public static void glLoadTransposeMatrixARB(FloatBuffer pfMtx) {
if (pfMtx.remaining() < 16) {
throw new BufferUnderflowException();