From 6917a1e1defc98ae9df409d3dae2846081bace20 Mon Sep 17 00:00:00 2001 From: Caspian Rychlik-Prince Date: Mon, 9 Feb 2004 23:37:28 +0000 Subject: [PATCH] The BIG LWJGL REFACTORING --- .../org/lwjgl/opengl/ARBFragmentProgram.java | 88 +++++++++---------- .../org/lwjgl/opengl/ARBFragmentShader.java | 6 +- .../org/lwjgl/opengl/ARBMatrixPalette.java | 10 +++ src/java/org/lwjgl/opengl/ARBMultisample.java | 11 +++ .../org/lwjgl/opengl/ARBMultitexture.java | 6 ++ .../org/lwjgl/opengl/ARBOcclusionQuery.java | 2 +- .../org/lwjgl/opengl/ARBPointParameters.java | 7 ++ src/java/org/lwjgl/opengl/ARBPointSprite.java | 9 +- src/java/org/lwjgl/opengl/ARBProgram.java | 9 ++ .../lwjgl/opengl/ARBTextureCompression.java | 6 ++ ...ARBCubeMap.java => ARBTextureCubeMap.java} | 9 +- .../org/lwjgl/opengl/ARBTransposeMatrix.java | 7 ++ 12 files changed, 119 insertions(+), 51 deletions(-) rename src/java/org/lwjgl/opengl/{ARBCubeMap.java => ARBTextureCubeMap.java} (94%) diff --git a/src/java/org/lwjgl/opengl/ARBFragmentProgram.java b/src/java/org/lwjgl/opengl/ARBFragmentProgram.java index 5cf72d10..3db686ab 100644 --- a/src/java/org/lwjgl/opengl/ARBFragmentProgram.java +++ b/src/java/org/lwjgl/opengl/ARBFragmentProgram.java @@ -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 parameter of Disable, Enable, and IsEnabled, - * by the parameter of GetBooleanv, GetIntegerv, GetFloatv, - * and GetDoublev, and by the parameter of ProgramStringARB, - * BindProgramARB, ProgramEnvParameter4[df][v]ARB, - * ProgramLocalParameter4[df][v]ARB, GetProgramEnvParameter[df]vARB, - * GetProgramLocalParameter[df]vARB, GetProgramivARB and - * GetProgramStringARB. - */ + * Accepted by the parameter of Disable, Enable, and IsEnabled, by the + * parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev, + * and by the 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 parameter of GetProgramivARB: - */ + * Accepted by the 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 parameter of GetBooleanv, GetIntegerv, - * GetFloatv, and GetDoublev: - */ + * Accepted by the 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); + } } diff --git a/src/java/org/lwjgl/opengl/ARBFragmentShader.java b/src/java/org/lwjgl/opengl/ARBFragmentShader.java index 0b8f7cc5..1767e20b 100644 --- a/src/java/org/lwjgl/opengl/ARBFragmentShader.java +++ b/src/java/org/lwjgl/opengl/ARBFragmentShader.java @@ -38,7 +38,7 @@ package org.lwjgl.opengl; -public interface ARBFragmentShader { +public class ARBFragmentShader { /* * Accepted by the 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); + } + } \ No newline at end of file diff --git a/src/java/org/lwjgl/opengl/ARBMatrixPalette.java b/src/java/org/lwjgl/opengl/ARBMatrixPalette.java index 0034c318..be0a9f09 100644 --- a/src/java/org/lwjgl/opengl/ARBMatrixPalette.java +++ b/src/java/org/lwjgl/opengl/ARBMatrixPalette.java @@ -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(); diff --git a/src/java/org/lwjgl/opengl/ARBMultisample.java b/src/java/org/lwjgl/opengl/ARBMultisample.java index 24dc505a..e683db29 100644 --- a/src/java/org/lwjgl/opengl/ARBMultisample.java +++ b/src/java/org/lwjgl/opengl/ARBMultisample.java @@ -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); } diff --git a/src/java/org/lwjgl/opengl/ARBMultitexture.java b/src/java/org/lwjgl/opengl/ARBMultitexture.java index c43146dd..0acc5514 100644 --- a/src/java/org/lwjgl/opengl/ARBMultitexture.java +++ b/src/java/org/lwjgl/opengl/ARBMultitexture.java @@ -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); diff --git a/src/java/org/lwjgl/opengl/ARBOcclusionQuery.java b/src/java/org/lwjgl/opengl/ARBOcclusionQuery.java index 15d2bcad..02c9e002 100644 --- a/src/java/org/lwjgl/opengl/ARBOcclusionQuery.java +++ b/src/java/org/lwjgl/opengl/ARBOcclusionQuery.java @@ -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()); diff --git a/src/java/org/lwjgl/opengl/ARBPointParameters.java b/src/java/org/lwjgl/opengl/ARBPointParameters.java index 1d0ef573..417a4e93 100644 --- a/src/java/org/lwjgl/opengl/ARBPointParameters.java +++ b/src/java/org/lwjgl/opengl/ARBPointParameters.java @@ -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) { diff --git a/src/java/org/lwjgl/opengl/ARBPointSprite.java b/src/java/org/lwjgl/opengl/ARBPointSprite.java index 8dcd59d2..7b46ceb4 100644 --- a/src/java/org/lwjgl/opengl/ARBPointSprite.java +++ b/src/java/org/lwjgl/opengl/ARBPointSprite.java @@ -7,7 +7,7 @@ package org.lwjgl.opengl; -public interface ARBPointSprite { +public class ARBPointSprite { /* * Accepted by the parameter of Enable, Disable, and IsEnabled, by @@ -15,7 +15,7 @@ public interface ARBPointSprite { * GetDoublev, and by the 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 parameter of TexEnvf, TexEnvfv, TexEnvi, TexEnviv, @@ -23,6 +23,9 @@ public interface ARBPointSprite { * 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); + } } \ No newline at end of file diff --git a/src/java/org/lwjgl/opengl/ARBProgram.java b/src/java/org/lwjgl/opengl/ARBProgram.java index 826ea1ca..5fd8b287 100644 --- a/src/java/org/lwjgl/opengl/ARBProgram.java +++ b/src/java/org/lwjgl/opengl/ARBProgram.java @@ -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) { diff --git a/src/java/org/lwjgl/opengl/ARBTextureCompression.java b/src/java/org/lwjgl/opengl/ARBTextureCompression.java index 961b0ccd..65e90fce 100644 --- a/src/java/org/lwjgl/opengl/ARBTextureCompression.java +++ b/src/java/org/lwjgl/opengl/ARBTextureCompression.java @@ -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()); diff --git a/src/java/org/lwjgl/opengl/ARBCubeMap.java b/src/java/org/lwjgl/opengl/ARBTextureCubeMap.java similarity index 94% rename from src/java/org/lwjgl/opengl/ARBCubeMap.java rename to src/java/org/lwjgl/opengl/ARBTextureCubeMap.java index 7932a7da..ea0f1fe2 100644 --- a/src/java/org/lwjgl/opengl/ARBCubeMap.java +++ b/src/java/org/lwjgl/opengl/ARBTextureCubeMap.java @@ -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); + } + } diff --git a/src/java/org/lwjgl/opengl/ARBTransposeMatrix.java b/src/java/org/lwjgl/opengl/ARBTransposeMatrix.java index aa8be182..0ba31378 100644 --- a/src/java/org/lwjgl/opengl/ARBTransposeMatrix.java +++ b/src/java/org/lwjgl/opengl/ARBTransposeMatrix.java @@ -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();