diff --git a/src/java/org/lwjgl/opengl/ARBBufferObject.java b/src/java/org/lwjgl/opengl/ARBBufferObject.java index 503f29c1..75660249 100644 --- a/src/java/org/lwjgl/opengl/ARBBufferObject.java +++ b/src/java/org/lwjgl/opengl/ARBBufferObject.java @@ -68,6 +68,8 @@ public final class ARBBufferObject { public static final int GL_BUFFER_MAPPED_ARB = 0x88BC; public static final int GL_BUFFER_MAP_POINTER_ARB = 0x88BD; + static native void initNativeStubs(); + public static void glBindBufferARB(int target, int buffer) { switch (target) { case ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB: diff --git a/src/java/org/lwjgl/opengl/ARBImaging.java b/src/java/org/lwjgl/opengl/ARBImaging.java index ef0551bb..b9c41d64 100644 --- a/src/java/org/lwjgl/opengl/ARBImaging.java +++ b/src/java/org/lwjgl/opengl/ARBImaging.java @@ -126,6 +126,8 @@ public final class ARBImaging { public static final int GL_MINMAX_FORMAT = 0x802F; public static final int GL_MINMAX_SINK = 0x8030; + static native void initNativeStubs(); + public static void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { BufferChecks.checkBuffer(data, 256); nglColorTable(target, internalFormat, width, format, type, data, data.position()); diff --git a/src/java/org/lwjgl/opengl/ARBMatrixPalette.java b/src/java/org/lwjgl/opengl/ARBMatrixPalette.java index 55482bbe..46a75dab 100644 --- a/src/java/org/lwjgl/opengl/ARBMatrixPalette.java +++ b/src/java/org/lwjgl/opengl/ARBMatrixPalette.java @@ -49,6 +49,8 @@ public final 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 native void initNativeStubs(); + public static native void glCurrentPaletteMatrixARB(int index); public static void glMatrixIndexPointerARB(int size, int stride, ByteBuffer pPointer) { BufferChecks.ensureArrayVBOdisabled(); diff --git a/src/java/org/lwjgl/opengl/ARBMultisample.java b/src/java/org/lwjgl/opengl/ARBMultisample.java index 72efad23..2400219a 100644 --- a/src/java/org/lwjgl/opengl/ARBMultisample.java +++ b/src/java/org/lwjgl/opengl/ARBMultisample.java @@ -42,6 +42,7 @@ public final class ARBMultisample { public static final int GL_SAMPLE_COVERAGE_INVERT_ARB = 0x80AB; public static final int GL_MULTISAMPLE_BIT_ARB = 0x20000000; - + static native void initNativeStubs(); + 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 bf99b14f..2b8f6cb3 100644 --- a/src/java/org/lwjgl/opengl/ARBMultitexture.java +++ b/src/java/org/lwjgl/opengl/ARBMultitexture.java @@ -68,6 +68,8 @@ public final class ARBMultitexture { public static final int GL_CLIENT_ACTIVE_TEXTURE_ARB = 0x84E1; public static final int GL_MAX_TEXTURE_UNITS_ARB = 0x84E2; + static native void initNativeStubs(); + public static native void glClientActiveTextureARB(int texture); public static native void glActiveTextureARB(int texture); diff --git a/src/java/org/lwjgl/opengl/ARBOcclusionQuery.java b/src/java/org/lwjgl/opengl/ARBOcclusionQuery.java index edf817a5..6e4f877d 100644 --- a/src/java/org/lwjgl/opengl/ARBOcclusionQuery.java +++ b/src/java/org/lwjgl/opengl/ARBOcclusionQuery.java @@ -54,6 +54,8 @@ public final class ARBOcclusionQuery { public static final int GL_QUERY_RESULT_ARB = 0x8866; public static final int GL_QUERY_RESULT_AVAILABLE_ARB = 0x8867; + static native void initNativeStubs(); + // --------------------------- 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 a112af0e..e2826425 100644 --- a/src/java/org/lwjgl/opengl/ARBPointParameters.java +++ b/src/java/org/lwjgl/opengl/ARBPointParameters.java @@ -39,6 +39,7 @@ public final class ARBPointParameters { public static final int GL_POINT_FADE_THRESHOLD_SIZE_ARB = 0x8128; public static final int GL_POINT_DISTANCE_ATTENUATION_ARB = 0x8129; + static native void initNativeStubs(); public static native void glPointParameterfARB(int pname, float param); diff --git a/src/java/org/lwjgl/opengl/ARBProgram.java b/src/java/org/lwjgl/opengl/ARBProgram.java index 8d741b71..5653ce29 100644 --- a/src/java/org/lwjgl/opengl/ARBProgram.java +++ b/src/java/org/lwjgl/opengl/ARBProgram.java @@ -129,6 +129,8 @@ public class ARBProgram { public static final int GL_MATRIX31_ARB = 0x88DF; + static native void initNativeStubs(); + // --------------------------- public static void glProgramStringARB(int target, int format, ByteBuffer string) { nglProgramStringARB(target, format, string.remaining(), string, string.position()); diff --git a/src/java/org/lwjgl/opengl/ARBShaderObjects.java b/src/java/org/lwjgl/opengl/ARBShaderObjects.java index 84b4598f..2e1ef740 100644 --- a/src/java/org/lwjgl/opengl/ARBShaderObjects.java +++ b/src/java/org/lwjgl/opengl/ARBShaderObjects.java @@ -90,6 +90,8 @@ public final class ARBShaderObjects { public static final int GL_SAMPLER_2D_RECT_ARB = 0x8B63; public static final int GL_SAMPLER_2D_RECT_SHADOW_ARB = 0x8B64; + static native void initNativeStubs(); + public static native void glDeleteObjectARB(int obj); public static native int glGetHandleARB(int pname); @@ -380,4 +382,4 @@ public final class ARBShaderObjects { IntBuffer length, int lengthOffset, ByteBuffer source, int sourceOffset); // --------------------------- -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/ARBTextureCompression.java b/src/java/org/lwjgl/opengl/ARBTextureCompression.java index 01c2e31c..e09f7f2b 100644 --- a/src/java/org/lwjgl/opengl/ARBTextureCompression.java +++ b/src/java/org/lwjgl/opengl/ARBTextureCompression.java @@ -51,6 +51,8 @@ public final class ARBTextureCompression public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A2; public static final int GL_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A3; + static native void initNativeStubs(); + public static void glCompressedTexImage1DARB(int target, int level, int internalformat, int width, int border, int imageSize, ByteBuffer pData) { nglCompressedTexImage1DARB(target, level, internalformat, width, border, imageSize, pData, pData.position()); } diff --git a/src/java/org/lwjgl/opengl/ARBTransposeMatrix.java b/src/java/org/lwjgl/opengl/ARBTransposeMatrix.java index 6f98013d..902a3f92 100644 --- a/src/java/org/lwjgl/opengl/ARBTransposeMatrix.java +++ b/src/java/org/lwjgl/opengl/ARBTransposeMatrix.java @@ -39,6 +39,8 @@ public final class ARBTransposeMatrix { public static final int GL_TRANSPOSE_TEXTURE_MATRIX_ARB = 0x84E5; public static final int GL_TRANSPOSE_COLOR_MATRIX_ARB = 0x84E6; + static native void initNativeStubs(); + public static void glLoadTransposeMatrixARB(FloatBuffer pfMtx) { BufferChecks.checkBuffer(pfMtx, 16); nglLoadTransposeMatrixfARB(pfMtx, pfMtx.position()); diff --git a/src/java/org/lwjgl/opengl/ARBVertexBlend.java b/src/java/org/lwjgl/opengl/ARBVertexBlend.java index 1bbe9674..f2f49475 100644 --- a/src/java/org/lwjgl/opengl/ARBVertexBlend.java +++ b/src/java/org/lwjgl/opengl/ARBVertexBlend.java @@ -82,6 +82,8 @@ public final class ARBVertexBlend { public static final int GL_MODELVIEW30_ARB = 0x873E; public static final int GL_MODELVIEW31_ARB = 0x873F; + static native void initNativeStubs(); + public static void glWeightARB(ByteBuffer pWeights) { nglWeightbvARB(pWeights.remaining(), pWeights, pWeights.position()); } diff --git a/src/java/org/lwjgl/opengl/ARBVertexProgram.java b/src/java/org/lwjgl/opengl/ARBVertexProgram.java index 18316ab8..dcf69941 100644 --- a/src/java/org/lwjgl/opengl/ARBVertexProgram.java +++ b/src/java/org/lwjgl/opengl/ARBVertexProgram.java @@ -87,6 +87,8 @@ public final class ARBVertexProgram extends ARBProgram { */ public static final int GL_MAX_VERTEX_ATTRIBS_ARB = 0x8869; + static native void initNativeStubs(); + public static native void glVertexAttrib1sARB(int index, short x); public static native void glVertexAttrib1fARB(int index, float x); diff --git a/src/java/org/lwjgl/opengl/ARBVertexShader.java b/src/java/org/lwjgl/opengl/ARBVertexShader.java index 59519ed0..9b70218a 100644 --- a/src/java/org/lwjgl/opengl/ARBVertexShader.java +++ b/src/java/org/lwjgl/opengl/ARBVertexShader.java @@ -94,6 +94,8 @@ public final class ARBVertexShader { public static final int GL_FLOAT_MAT3_ARB = 0x8B5B; public static final int GL_FLOAT_MAT4_ARB = 0x8B5C; + static native void initNativeStubs(); + // --------------------------- public static void glBindAttribLocationARB(int programObj, int index, ByteBuffer name) { if ( name.get(name.limit() - 1) != 0 ) { diff --git a/src/java/org/lwjgl/opengl/ARBWindowPos.java b/src/java/org/lwjgl/opengl/ARBWindowPos.java index 5d5ff2de..707eef59 100644 --- a/src/java/org/lwjgl/opengl/ARBWindowPos.java +++ b/src/java/org/lwjgl/opengl/ARBWindowPos.java @@ -32,6 +32,8 @@ package org.lwjgl.opengl; public final class ARBWindowPos { + static native void initNativeStubs(); + public static native void glWindowPos2fARB(float x, float y); public static native void glWindowPos2iARB(int x, int y); diff --git a/src/java/org/lwjgl/opengl/ATIDrawBuffers.java b/src/java/org/lwjgl/opengl/ATIDrawBuffers.java index 32556b17..c903ae04 100644 --- a/src/java/org/lwjgl/opengl/ATIDrawBuffers.java +++ b/src/java/org/lwjgl/opengl/ATIDrawBuffers.java @@ -58,6 +58,8 @@ public final class ATIDrawBuffers { public static final int GL_DRAW_BUFFER15_ATI = 0x8834; + static native void initNativeStubs(); + // --------------------------- public static void glDrawBuffersATI(IntBuffer buffers) { if (buffers.remaining() == 0) { diff --git a/src/java/org/lwjgl/opengl/ATIElementArray.java b/src/java/org/lwjgl/opengl/ATIElementArray.java index 4cae42d9..06c5d338 100644 --- a/src/java/org/lwjgl/opengl/ATIElementArray.java +++ b/src/java/org/lwjgl/opengl/ATIElementArray.java @@ -42,6 +42,8 @@ public final class ATIElementArray { public static final int GL_ELEMENT_ARRAY_TYPE_ATI = 0x8769; public static final int GL_ELEMENT_ARRAY_POINTER_ATI = 0x876A; + static native void initNativeStubs(); + public static void glElementPointerATI(ByteBuffer pPointer) { BufferChecks.ensureArrayVBOdisabled(); nglElementPointerATI(GL11.GL_UNSIGNED_BYTE, pPointer, pPointer.position()); diff --git a/src/java/org/lwjgl/opengl/ATIEnvmapBumpmap.java b/src/java/org/lwjgl/opengl/ATIEnvmapBumpmap.java index a49908f9..2fdd805a 100644 --- a/src/java/org/lwjgl/opengl/ATIEnvmapBumpmap.java +++ b/src/java/org/lwjgl/opengl/ATIEnvmapBumpmap.java @@ -44,6 +44,8 @@ public final class ATIEnvmapBumpmap { public static final int GL_BUMP_ENVMAP_ATI = 0x877B; public static final int GL_BUMP_TARGET_ATI = 0x877C; + static native void initNativeStubs(); + public static void glTexBumpParameterATI(int pname, FloatBuffer pfParam) { BufferChecks.checkBuffer(pfParam); nglTexBumpParameterfvATI(pname, pfParam, pfParam.position()); diff --git a/src/java/org/lwjgl/opengl/ATIFragmentShader.java b/src/java/org/lwjgl/opengl/ATIFragmentShader.java index f1931562..83c473c7 100644 --- a/src/java/org/lwjgl/opengl/ATIFragmentShader.java +++ b/src/java/org/lwjgl/opengl/ATIFragmentShader.java @@ -144,6 +144,7 @@ public final class ATIFragmentShader { public static final int GL_NEGATE_BIT_ATI = 0x00000004; public static final int GL_BIAS_BIT_ATI = 0x00000008; + static native void initNativeStubs(); public static native int glGenFragmentShadersATI(int range); diff --git a/src/java/org/lwjgl/opengl/ATIMapObjectBuffer.java b/src/java/org/lwjgl/opengl/ATIMapObjectBuffer.java index 78483962..e91fcf7b 100644 --- a/src/java/org/lwjgl/opengl/ATIMapObjectBuffer.java +++ b/src/java/org/lwjgl/opengl/ATIMapObjectBuffer.java @@ -35,6 +35,8 @@ import java.nio.ByteBuffer; public final class ATIMapObjectBuffer { + static native void initNativeStubs(); + /** * glMapObjectBufferATI maps a gl object 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 @@ -52,4 +54,4 @@ public final class ATIMapObjectBuffer { public static native void glUnmapObjectBufferATI(int buffer); -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/ATIPnTriangles.java b/src/java/org/lwjgl/opengl/ATIPnTriangles.java index 7d07089d..2f9f6fc6 100644 --- a/src/java/org/lwjgl/opengl/ATIPnTriangles.java +++ b/src/java/org/lwjgl/opengl/ATIPnTriangles.java @@ -42,6 +42,8 @@ public final class ATIPnTriangles { public static final int GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = 0x87F7; public static final int GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = 0x87F8; + static native void initNativeStubs(); + public static native void glPNTrianglesfATI(int pname, float param); public static native void glPNTrianglesiATI(int pname, int param); diff --git a/src/java/org/lwjgl/opengl/ATISeparateStencil.java b/src/java/org/lwjgl/opengl/ATISeparateStencil.java index 3b585e2c..a1c833d0 100644 --- a/src/java/org/lwjgl/opengl/ATISeparateStencil.java +++ b/src/java/org/lwjgl/opengl/ATISeparateStencil.java @@ -37,6 +37,8 @@ public final class ATISeparateStencil { public static final int GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI = 0x8802; public static final int GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI = 0x8803; + static native void initNativeStubs(); + public static native void glStencilOpSeparateATI(int face, int sfail, int dpfail, int dppass); public static native void glStencilFuncSeparateATI(int frontfunc, int backfunc, int ref, int mask); } diff --git a/src/java/org/lwjgl/opengl/ATIVertexArrayObject.java b/src/java/org/lwjgl/opengl/ATIVertexArrayObject.java index f70c92a2..9caba132 100644 --- a/src/java/org/lwjgl/opengl/ATIVertexArrayObject.java +++ b/src/java/org/lwjgl/opengl/ATIVertexArrayObject.java @@ -47,6 +47,8 @@ public final class ATIVertexArrayObject { public static final int GL_ARRAY_OBJECT_BUFFER_ATI = 0x8766; public static final int GL_ARRAY_OBJECT_OFFSET_ATI = 0x8767; + static native void initNativeStubs(); + public static int glNewObjectBufferATI(int size, ByteBuffer pPointer, int usage) { return nglNewObjectBufferATI(size, pPointer, pPointer != null ? pPointer.position() : 0, usage); } diff --git a/src/java/org/lwjgl/opengl/ATIVertexAttribArrayObject.java b/src/java/org/lwjgl/opengl/ATIVertexAttribArrayObject.java index efccf377..b6ff14b5 100644 --- a/src/java/org/lwjgl/opengl/ATIVertexAttribArrayObject.java +++ b/src/java/org/lwjgl/opengl/ATIVertexAttribArrayObject.java @@ -36,6 +36,8 @@ import java.nio.IntBuffer; public final class ATIVertexAttribArrayObject { + static native void initNativeStubs(); + public static native void glVertexAttribArrayObjectATI(int index, int size, int type, boolean normalized, int stride, int buffer, int offset); @@ -61,4 +63,4 @@ public final class ATIVertexAttribArrayObject { IntBuffer params, int paramsOffset); // --------------------------- -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/ATIVertexStreams.java b/src/java/org/lwjgl/opengl/ATIVertexStreams.java index fe1dc2f8..a2911ebc 100644 --- a/src/java/org/lwjgl/opengl/ATIVertexStreams.java +++ b/src/java/org/lwjgl/opengl/ATIVertexStreams.java @@ -43,6 +43,8 @@ public final class ATIVertexStreams { public static final int GL_VERTEX_STREAM6_ATI = 0x8773; public static final int GL_VERTEX_STREAM7_ATI = 0x8774; + static native void initNativeStubs(); + public static native void glVertexStream1fATI(int stream, float x); public static native void glVertexStream1iATI(int stream, int x); public static native void glVertexStream1sATI(int stream, short x); diff --git a/src/java/org/lwjgl/opengl/Display.java b/src/java/org/lwjgl/opengl/Display.java index 601150a8..57fd233f 100644 --- a/src/java/org/lwjgl/opengl/Display.java +++ b/src/java/org/lwjgl/opengl/Display.java @@ -462,9 +462,10 @@ public final class Display { private static native void swapBuffers(); /** - * Make the Display the current rendering context for GL calls. + * Make the Display the current rendering context for GL calls. Also initialize native stubs. + * @throws LWJGLException If the context could not be made current */ - public static synchronized void makeCurrent() { + public static synchronized void makeCurrent() throws LWJGLException { if (!isCreated()) throw new IllegalStateException("No window created to make current"); nMakeCurrent(); @@ -474,7 +475,7 @@ public final class Display { /** * Make the window the current rendering context for GL calls. */ - private static native void nMakeCurrent(); + private static native void nMakeCurrent() throws LWJGLException; /** * Create the OpenGL context. If isFullscreen() is true or if windowed @@ -596,6 +597,11 @@ public final class Display { destroyWindow(); destroyContext(); context = null; + try { + GLContext.useContext(null); + } catch (LWJGLException e) { + // ignore exception + } reset(); } diff --git a/src/java/org/lwjgl/opengl/EXTBlendEquationSeparate.java b/src/java/org/lwjgl/opengl/EXTBlendEquationSeparate.java index d90c9c87..da5a0a82 100644 --- a/src/java/org/lwjgl/opengl/EXTBlendEquationSeparate.java +++ b/src/java/org/lwjgl/opengl/EXTBlendEquationSeparate.java @@ -40,6 +40,8 @@ public final class EXTBlendEquationSeparate { public static final int GL_BLEND_EQUATION_RGB_EXT = 0x8009; public static final int GL_BLEND_EQUATION_ALPHA_EXT = 0x883D; + static native void initNativeStubs(); + public static native void glBlendEquationSeparateEXT(int modeRGB, int modeAlpha); -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/EXTBlendFuncSeparate.java b/src/java/org/lwjgl/opengl/EXTBlendFuncSeparate.java index 332c1f8e..7bbad650 100644 --- a/src/java/org/lwjgl/opengl/EXTBlendFuncSeparate.java +++ b/src/java/org/lwjgl/opengl/EXTBlendFuncSeparate.java @@ -41,5 +41,7 @@ public final class EXTBlendFuncSeparate { public static final int GL_BLEND_DST_ALPHA_EXT = 0x80CA; public static final int GL_BLEND_SRC_ALPHA_EXT = 0x80CB; + static native void initNativeStubs(); + public static native void glBlendFuncSeparateEXT(int sfactorRGB, int dfactorRGB, int sfactorAlpha, int dfactorAlpha); } diff --git a/src/java/org/lwjgl/opengl/EXTCompiledVertexArray.java b/src/java/org/lwjgl/opengl/EXTCompiledVertexArray.java index c2497442..f2db938c 100644 --- a/src/java/org/lwjgl/opengl/EXTCompiledVertexArray.java +++ b/src/java/org/lwjgl/opengl/EXTCompiledVertexArray.java @@ -35,7 +35,8 @@ public final class EXTCompiledVertexArray { public static final int GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = 0x81A8; public static final int GL_ARRAY_ELEMENT_LOCK_COUNT_EXT = 0x81A9; - + static native void initNativeStubs(); + public static native void glLockArraysEXT(int first, int count); public static native void glUnlockArraysEXT(); } diff --git a/src/java/org/lwjgl/opengl/EXTDepthBoundsTest.java b/src/java/org/lwjgl/opengl/EXTDepthBoundsTest.java index f124ebc0..85edc329 100644 --- a/src/java/org/lwjgl/opengl/EXTDepthBoundsTest.java +++ b/src/java/org/lwjgl/opengl/EXTDepthBoundsTest.java @@ -46,6 +46,8 @@ public final class EXTDepthBoundsTest { */ public static final int DEPTH_BOUNDS_EXT = 0x8891; + static native void initNativeStubs(); + public static native void glDepthBoundsEXT(float zmin, float zmax); -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/EXTDrawRangeElements.java b/src/java/org/lwjgl/opengl/EXTDrawRangeElements.java index c43cf205..ec1bea48 100644 --- a/src/java/org/lwjgl/opengl/EXTDrawRangeElements.java +++ b/src/java/org/lwjgl/opengl/EXTDrawRangeElements.java @@ -41,6 +41,8 @@ public final class EXTDrawRangeElements { public static final int GL_MAX_ELEMENTS_VERTICES_EXT = 0x80E8; public static final int GL_MAX_ELEMENTS_INDICES_EXT = 0x80E9; + static native void initNativeStubs(); + public static void glDrawRangeElementsEXT(int mode, int start, int end, ByteBuffer pIndices) { BufferChecks.ensureElementVBOdisabled(); nglDrawRangeElementsEXT(mode, start, end, pIndices.remaining(), GL11.GL_UNSIGNED_BYTE, pIndices, pIndices.position()); diff --git a/src/java/org/lwjgl/opengl/EXTFogCoord.java b/src/java/org/lwjgl/opengl/EXTFogCoord.java index 14265f1d..46405085 100644 --- a/src/java/org/lwjgl/opengl/EXTFogCoord.java +++ b/src/java/org/lwjgl/opengl/EXTFogCoord.java @@ -46,6 +46,8 @@ public final class EXTFogCoord { public static final int GL_FOG_COORDINATE_ARRAY_EXT = 0x8457; + static native void initNativeStubs(); + public static native void glFogCoordfEXT(float coord); public static void glFogCoordPointerEXT(int stride, FloatBuffer data) { BufferChecks.ensureArrayVBOdisabled(); diff --git a/src/java/org/lwjgl/opengl/EXTMultiDrawArrays.java b/src/java/org/lwjgl/opengl/EXTMultiDrawArrays.java index c1f0d1f0..66bd8704 100644 --- a/src/java/org/lwjgl/opengl/EXTMultiDrawArrays.java +++ b/src/java/org/lwjgl/opengl/EXTMultiDrawArrays.java @@ -34,6 +34,8 @@ package org.lwjgl.opengl; import java.nio.IntBuffer; public final class EXTMultiDrawArrays { + static native void initNativeStubs(); + public static void glMultiDrawArraysEXT(int mode, IntBuffer piFirst, IntBuffer piCount) { if (piFirst.remaining() != piCount.remaining()) { throw new IllegalArgumentException("piFirst.remaining() != piCount.remaining()"); diff --git a/src/java/org/lwjgl/opengl/EXTPointParameters.java b/src/java/org/lwjgl/opengl/EXTPointParameters.java index ddb42d62..10c43828 100644 --- a/src/java/org/lwjgl/opengl/EXTPointParameters.java +++ b/src/java/org/lwjgl/opengl/EXTPointParameters.java @@ -39,6 +39,8 @@ public final class EXTPointParameters { public static final int GL_POINT_FADE_THRESHOLD_SIZE_EXT = 0x8128; public static final int GL_DISTANCE_ATTENUATION_EXT = 0x8129; + static native void initNativeStubs(); + public static native void glPointParameterfEXT(int pname, float param); public static void glPointParameterEXT(int pname, FloatBuffer pfParams) { diff --git a/src/java/org/lwjgl/opengl/EXTSecondaryColor.java b/src/java/org/lwjgl/opengl/EXTSecondaryColor.java index 9b1132eb..0617250a 100644 --- a/src/java/org/lwjgl/opengl/EXTSecondaryColor.java +++ b/src/java/org/lwjgl/opengl/EXTSecondaryColor.java @@ -45,6 +45,8 @@ public final class EXTSecondaryColor { public static final int GL_SECONDARY_COLOR_ARRAY_POINTER_EXT = 0x845D; public static final int GL_SECONDARY_COLOR_ARRAY_EXT = 0x845E; + static native void initNativeStubs(); + public static native void glSecondaryColor3bEXT(byte red, byte green, byte blue); public static native void glSecondaryColor3fEXT(float red, float green, float blue); diff --git a/src/java/org/lwjgl/opengl/EXTStencilTwoSide.java b/src/java/org/lwjgl/opengl/EXTStencilTwoSide.java index fdb56e7d..03fb8a84 100644 --- a/src/java/org/lwjgl/opengl/EXTStencilTwoSide.java +++ b/src/java/org/lwjgl/opengl/EXTStencilTwoSide.java @@ -35,5 +35,7 @@ public final class EXTStencilTwoSide { public static final int GL_STENCIL_TEST_TWO_SIDE_EXT = 0x8910; public static final int GL_ACTIVE_STENCIL_FACE_EXT = 0x8911; + static native void initNativeStubs(); + public static native void glActiveStencilFaceEXT(int face); } diff --git a/src/java/org/lwjgl/opengl/EXTVertexShader.java b/src/java/org/lwjgl/opengl/EXTVertexShader.java index a771be77..518fc66d 100644 --- a/src/java/org/lwjgl/opengl/EXTVertexShader.java +++ b/src/java/org/lwjgl/opengl/EXTVertexShader.java @@ -150,6 +150,8 @@ public final class EXTVertexShader { public static final int GL_LOCAL_CONSTANT_VALUE_EXT = 0x87EC; public static final int GL_LOCAL_CONSTANT_DATATYPE_EXT = 0x87ED; + static native void initNativeStubs(); + public static native void glBeginVertexShaderEXT(); public static native void glEndVertexShaderEXT(); diff --git a/src/java/org/lwjgl/opengl/EXTVertexWeighting.java b/src/java/org/lwjgl/opengl/EXTVertexWeighting.java index 7a19da1f..84798a13 100644 --- a/src/java/org/lwjgl/opengl/EXTVertexWeighting.java +++ b/src/java/org/lwjgl/opengl/EXTVertexWeighting.java @@ -50,6 +50,8 @@ public final class EXTVertexWeighting { public static final int GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 0x850F; public static final int GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT = 0x8510; + static native void initNativeStubs(); + public static native void glVertexWeightfEXT(float weight); public static void glVertexWeightPointerEXT(int size, int stride, FloatBuffer pPointer) { diff --git a/src/java/org/lwjgl/opengl/GL11.java b/src/java/org/lwjgl/opengl/GL11.java index 25ff0cb0..791645b1 100644 --- a/src/java/org/lwjgl/opengl/GL11.java +++ b/src/java/org/lwjgl/opengl/GL11.java @@ -719,7 +719,9 @@ public final class GL11 { /* For compatibility with OpenGL v1.0 */ public static final int GL_LOGIC_OP = GL_INDEX_LOGIC_OP; public static final int GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT; - + + static native void initNativeStubs(); + public static native void glAccum(int op, float value); public static native void glAlphaFunc(int func, float ref); public static native void glClearColor(float red, float green, float blue, float alpha); diff --git a/src/java/org/lwjgl/opengl/GL12.java b/src/java/org/lwjgl/opengl/GL12.java index 205945d6..50af538c 100644 --- a/src/java/org/lwjgl/opengl/GL12.java +++ b/src/java/org/lwjgl/opengl/GL12.java @@ -89,6 +89,8 @@ public final class GL12 { public static final int GL_ALIASED_POINT_SIZE_RANGE = 0x846D; public static final int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E; + static native void initNativeStubs(); + public static void glDrawRangeElements(int mode, int start, int end, ByteBuffer indices) { BufferChecks.ensureElementVBOdisabled(); nglDrawRangeElements(mode, start, end, indices.remaining(), GL11.GL_UNSIGNED_BYTE, indices, indices.position()); diff --git a/src/java/org/lwjgl/opengl/GL13.java b/src/java/org/lwjgl/opengl/GL13.java index bd043959..61d4d94f 100644 --- a/src/java/org/lwjgl/opengl/GL13.java +++ b/src/java/org/lwjgl/opengl/GL13.java @@ -148,6 +148,8 @@ public final class GL13 { public static final int GL_DOT3_RGBA = 0x86AF; public static final int GL_CLAMP_TO_BORDER = 0x812D; + static native void initNativeStubs(); + public static native void glActiveTexture(int texture); public static native void glClientActiveTexture(int texture); public static void glCompressedTexImage1D(int target, int level, int internalformat, int width, int border, int imageSize, ByteBuffer data) { diff --git a/src/java/org/lwjgl/opengl/GL14.java b/src/java/org/lwjgl/opengl/GL14.java index 5b4897e2..fe93fe80 100644 --- a/src/java/org/lwjgl/opengl/GL14.java +++ b/src/java/org/lwjgl/opengl/GL14.java @@ -85,6 +85,8 @@ public final class GL14 { public static final int GL_MAX_TEXTURE_LOD_BIAS = 0x84FD; public static final int GL_GL_MIRRORED_REPEAT = 0x8370; + static native void initNativeStubs(); + public static native void glBlendEquation(int mode); public static native void glBlendColor(float red, float green, float blue, float alpha); public static native void glFogCoordf(float coord); diff --git a/src/java/org/lwjgl/opengl/GL15.java b/src/java/org/lwjgl/opengl/GL15.java index 25d84e45..75aafaa8 100644 --- a/src/java/org/lwjgl/opengl/GL15.java +++ b/src/java/org/lwjgl/opengl/GL15.java @@ -71,6 +71,8 @@ public final class GL15 { public static final int GL_BUFFER_MAPPED = 0x88BC; public static final int GL_BUFFER_MAP_POINTER = 0x88BD; + static native void initNativeStubs(); + public static void glBindBuffer(int target, int buffer) { switch ( target ) { case GL_ELEMENT_ARRAY_BUFFER: diff --git a/src/java/org/lwjgl/opengl/GLContext.java b/src/java/org/lwjgl/opengl/GLContext.java index 6be3fe4e..953faa04 100644 --- a/src/java/org/lwjgl/opengl/GLContext.java +++ b/src/java/org/lwjgl/opengl/GLContext.java @@ -36,8 +36,15 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.HashSet; import java.util.Set; +import java.util.HashMap; +import java.util.Map; +import java.util.Iterator; +import java.util.StringTokenizer; + +import java.lang.reflect.Method; import org.lwjgl.Sys; +import org.lwjgl.LWJGLException; /** * $Id$ @@ -174,6 +181,9 @@ public final class GLContext { public static boolean OpenGL14; public static boolean OpenGL15; + /** Map of classes that have native stubs loaded */ + private static Map exts; + static { Sys.initialize(); } @@ -204,18 +214,21 @@ public final class GLContext { /** * Makes a GL context the current context. This method does not make the context current though! * Instead it simply ensures that the current context is reflected accurately by GLContext's - * extension caps and function pointers. + * extension caps and function pointers. Use useContext(null) when no context is active. *

If the context is the same as last time, then this is a no-op. *

If the context has not been encountered before it will be fully initialized from scratch. * Otherwise a cached set of caps and function pointers will be used. *

The reference to the context is held in a weak reference; therefore if no strong reference * exists to the GL context it will automatically be forgotten by the VM at an indeterminate point * in the future, freeing up a little RAM. - * @param context The context object, which uniquely identifies a GL context + * @param context The context object, which uniquely identifies a GL context. If context is null, + * the native stubs are unloaded. + * @throws LWJGLException if context non-null, and the gl library can't be loaded or the basic GL11 functions can't be loaded */ - public static synchronized void useContext(Object context) { + public static synchronized void useContext(Object context) throws LWJGLException { if (context == null) { - throw new NullPointerException("Can't use a null context"); + unloadStubs(); + return; } // Is this the same as last time? Object current = currentContext == null ? null : currentContext.get(); @@ -223,18 +236,111 @@ public final class GLContext { // Yes, so we don't need to do anything. Our caps and function pointers are still valid. return; } - + // Ok, now it's the current context. + loadOpenGLLibrary(); + GL11.initNativeStubs(); + loadStubs(); currentContext = new WeakReference(context); - HashSet exts = new HashSet(); - init(exts); - determineAvailableExtensions(exts); VBOTracker.setCurrent(currentContext); } + private static void getExtensionClassesAndNames(Map exts, Set exts_names) { + String version_string = GL11.glGetString(GL11.GL_VERSION); + int version_index = version_string.indexOf("1."); + if (version_index != -1) { + String version = version_string.substring(version_index); + char minor_version = version_string.charAt(2); + switch (minor_version) { + case '5': + addExtensionClass(exts, exts_names, "GL15", "OpenGL15"); + // Fall through + case '4': + addExtensionClass(exts, exts_names, "GL14", "OpenGL14"); + // Fall through + case '3': + addExtensionClass(exts, exts_names, "GL13", "OpenGL13"); + // Fall through + case '2': + addExtensionClass(exts, exts_names, "GL12", "OpenGL12"); + // Fall through + default: + break; + } + + } + String extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS); + StringTokenizer tokenizer = new StringTokenizer(extensions_string); + while (tokenizer.hasMoreTokens()) { + String extension_string = tokenizer.nextToken(); + StringBuffer converted_name = new StringBuffer(); + int gl_prefix_index = extension_string.indexOf("GL_"); + if (gl_prefix_index == -1) + continue; + for (int i = gl_prefix_index + 3; i < extension_string.length(); i++) { + char c; + if (extension_string.charAt(i) == '_') { + i++; + c = Character.toUpperCase(extension_string.charAt(i)); + } else + c = extension_string.charAt(i); + converted_name.append(c); + } + addExtensionClass(exts, exts_names, converted_name.toString(), extension_string); + } + addExtensionClass(exts, exts_names, "ARBBufferObject", null); + addExtensionClass(exts, exts_names, "ARBProgram", null); + addExtensionClass(exts, exts_names, "NVProgram", null); + } + + private static void addExtensionClass(Map exts, Set exts_names, String ext_class_name, String ext_name) { + if (ext_name != null) + exts_names.add(ext_name); + try { + Class extension_class = Class.forName("org.lwjgl.opengl." + ext_class_name); + extension_class.getDeclaredMethod("initNativeStubs", null); // check for existance of initNativeStubs method + exts.put(extension_class, ext_name); + } catch (ClassNotFoundException e) { + // ignore + } catch (NoSuchMethodException e) { + // ignore + } + } + + private static void loadStubs() { + exts = new HashMap(); + Set exts_names = new HashSet(); + getExtensionClassesAndNames(exts, exts_names); + Iterator exts_it = exts.keySet().iterator(); + while (exts_it.hasNext()) { + Class extension_class = (Class)exts_it.next(); + resetNativeStubs(extension_class); + try { + Method init_stubs_method = extension_class.getDeclaredMethod("initNativeStubs", null); + init_stubs_method.invoke(null, null); + String ext_name = (String)exts.get(extension_class); + } catch (Exception e) { + Sys.log("Failed to initialize extension " + extension_class); + exts_it.remove(); + exts_names.remove(exts.get(extension_class)); + } + } + determineAvailableExtensions(exts_names); + } + + private static void unloadStubs() { + Iterator exts_it = exts.keySet().iterator(); + while (exts_it.hasNext()) + resetNativeStubs((Class)exts_it.next()); + } + /** - * Native method to initialize a context - * @param exts An empty Set of Strings that will be filled with the names of enabled extensions + * Native method to load the OpenGL library */ - private static native void init(Set exts); + private static native void loadOpenGLLibrary(); + + /** + * Native method to clear native stub bindings + */ + private static native void resetNativeStubs(Class clazz); } diff --git a/src/java/org/lwjgl/opengl/NVEvaluators.java b/src/java/org/lwjgl/opengl/NVEvaluators.java index aa652183..cc5a0857 100644 --- a/src/java/org/lwjgl/opengl/NVEvaluators.java +++ b/src/java/org/lwjgl/opengl/NVEvaluators.java @@ -61,6 +61,8 @@ public final class NVEvaluators { public static final int GL_MAX_MAP_TESSELLATION_NV = 0x86D6; public static final int GL_MAX_RATIONAL_EVAL_ORDER_NV = 0x86D7; + static native void initNativeStubs(); + public static void glGetMapControlPointsNV(int target, int index, int type, int ustride, int vstride, boolean packed, FloatBuffer pPoints) { // TODO:Check buffer size nglGetMapControlPointsNV(target, index, type, ustride, vstride, packed, pPoints, pPoints.position()<<2); diff --git a/src/java/org/lwjgl/opengl/NVFence.java b/src/java/org/lwjgl/opengl/NVFence.java index 930bc6f1..2237e7bb 100644 --- a/src/java/org/lwjgl/opengl/NVFence.java +++ b/src/java/org/lwjgl/opengl/NVFence.java @@ -38,6 +38,8 @@ public final class NVFence { public static final int GL_FENCE_STATUS_NV = 0x84F3; public static final int GL_FENCE_CONDITION_NV = 0x84F4; + static native void initNativeStubs(); + public static void glGenFencesNV(IntBuffer piFences) { nglGenFencesNV(piFences.remaining(), piFences, piFences.position()); } diff --git a/src/java/org/lwjgl/opengl/NVFragmentProgram.java b/src/java/org/lwjgl/opengl/NVFragmentProgram.java index 6e50616b..00ffc7eb 100644 --- a/src/java/org/lwjgl/opengl/NVFragmentProgram.java +++ b/src/java/org/lwjgl/opengl/NVFragmentProgram.java @@ -55,6 +55,8 @@ public final class NVFragmentProgram extends NVProgram { public static final int GL_FRAGMENT_PROGRAM_BINDING_NV = 0x8873; public static final int GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = 0x8868; + static native void initNativeStubs(); + // --------------------------- public static void glProgramNamedParameter4fNV(int id, ByteBuffer name, float x, float y, float z, float w) { diff --git a/src/java/org/lwjgl/opengl/NVHalfFloat.java b/src/java/org/lwjgl/opengl/NVHalfFloat.java index 9dc5db3e..7f6f4ab2 100644 --- a/src/java/org/lwjgl/opengl/NVHalfFloat.java +++ b/src/java/org/lwjgl/opengl/NVHalfFloat.java @@ -44,6 +44,8 @@ public final class NVHalfFloat { */ public static final int GL_HALF_FLOAT_NV = 0x140B; + static native void initNativeStubs(); + public static native void glVertex2hNV(short x, short y); public static native void glVertex3hNV(short x, short y, short z); @@ -120,4 +122,4 @@ public final class NVHalfFloat { int attribsOffset); // --------------------------- -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/NVOcclusionQuery.java b/src/java/org/lwjgl/opengl/NVOcclusionQuery.java index 836142b9..c3790db7 100644 --- a/src/java/org/lwjgl/opengl/NVOcclusionQuery.java +++ b/src/java/org/lwjgl/opengl/NVOcclusionQuery.java @@ -42,6 +42,8 @@ public final class NVOcclusionQuery { public static final int GL_PIXEL_COUNT_NV = 0x8866; public static final int GL_PIXEL_COUNT_AVAILABLE_NV = 0x8867; + static native void initNativeStubs(); + public static void glGenOcclusionQueriesNV(IntBuffer piIDs) { nglGenOcclusionQueriesNV(piIDs.remaining(), piIDs, piIDs.position()); } diff --git a/src/java/org/lwjgl/opengl/NVPixelDataRange.java b/src/java/org/lwjgl/opengl/NVPixelDataRange.java index 67ddceaa..2126dd3e 100644 --- a/src/java/org/lwjgl/opengl/NVPixelDataRange.java +++ b/src/java/org/lwjgl/opengl/NVPixelDataRange.java @@ -60,6 +60,8 @@ public final class NVPixelDataRange { public static final int GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV = 0x887C; public static final int GL_READ_PIXEL_DATA_RANGE_POINTER_NV = 0x887D; + static native void initNativeStubs(); + // --------------------------- public static void glPixelDataRangeNV(int target, ByteBuffer data) { nglPixelDataRangeNV(target, data.remaining(), data, data.position()); @@ -83,4 +85,4 @@ public final class NVPixelDataRange { public static native void glFlushPixelDataRangeNV(int target); -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/NVPointSprite.java b/src/java/org/lwjgl/opengl/NVPointSprite.java index 57579c7a..7952cf00 100644 --- a/src/java/org/lwjgl/opengl/NVPointSprite.java +++ b/src/java/org/lwjgl/opengl/NVPointSprite.java @@ -38,6 +38,8 @@ public final class NVPointSprite { public static final int GL_COORD_REPLACE_NV = 0x8862; public static final int GL_POINT_SPRITE_R_MODE_NV = 0x8863; + static native void initNativeStubs(); + public static native void glPointParameteriNV(int pname, int param); public static void glPointParameterNV(int pname, IntBuffer piParams) { diff --git a/src/java/org/lwjgl/opengl/NVPrimitiveRestart.java b/src/java/org/lwjgl/opengl/NVPrimitiveRestart.java index 28ae3460..1ae84be5 100644 --- a/src/java/org/lwjgl/opengl/NVPrimitiveRestart.java +++ b/src/java/org/lwjgl/opengl/NVPrimitiveRestart.java @@ -47,8 +47,10 @@ public final class NVPrimitiveRestart { */ public static final int GL_PRIMITIVE_RESTART_INDEX_NV = 0x8559; + static native void initNativeStubs(); + public static native void glPrimitiveRestartNV(); public static native void glPrimitiveRestartIndexNV(int index); -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/opengl/NVProgram.java b/src/java/org/lwjgl/opengl/NVProgram.java index ef500f11..38296557 100644 --- a/src/java/org/lwjgl/opengl/NVProgram.java +++ b/src/java/org/lwjgl/opengl/NVProgram.java @@ -60,6 +60,8 @@ public class NVProgram { */ public static final int GL_PROGRAM_ERROR_STRING_NV = 0x8874; + static native void initNativeStubs(); + // --------------------------- public static void glLoadProgramNV(int target, int programID, ByteBuffer string) { nglLoadProgramNV(target, programID, string.remaining(), string, string.position()); diff --git a/src/java/org/lwjgl/opengl/NVRegisterCombiners.java b/src/java/org/lwjgl/opengl/NVRegisterCombiners.java index 36baa479..a37e4775 100644 --- a/src/java/org/lwjgl/opengl/NVRegisterCombiners.java +++ b/src/java/org/lwjgl/opengl/NVRegisterCombiners.java @@ -87,6 +87,8 @@ public final class NVRegisterCombiners { public static final int GL_COLOR_SUM_CLAMP_NV = 0x854F; public static final int GL_MAX_GENERAL_COMBINERS_NV = 0x854D; + static native void initNativeStubs(); + public static native void glCombinerParameterfNV(int pname, float param); public static void glCombinerParameterNV(int pname, FloatBuffer pfParams) { diff --git a/src/java/org/lwjgl/opengl/NVRegisterCombiners2.java b/src/java/org/lwjgl/opengl/NVRegisterCombiners2.java index efb7fdf9..8dfc3031 100644 --- a/src/java/org/lwjgl/opengl/NVRegisterCombiners2.java +++ b/src/java/org/lwjgl/opengl/NVRegisterCombiners2.java @@ -37,6 +37,8 @@ public final class NVRegisterCombiners2 { public static final int GL_PER_STAGE_CONSTANTS_NV = 0x8535; + static native void initNativeStubs(); + public static void glCombinerStageParameterNV(int stage, int pname, FloatBuffer pfParams) { BufferChecks.checkBuffer(pfParams); nglCombinerStageParameterfvNV(stage, pname, pfParams, pfParams.position()); diff --git a/src/java/org/lwjgl/opengl/NVVertexArrayRange.java b/src/java/org/lwjgl/opengl/NVVertexArrayRange.java index 7e6e3d6a..f048942e 100644 --- a/src/java/org/lwjgl/opengl/NVVertexArrayRange.java +++ b/src/java/org/lwjgl/opengl/NVVertexArrayRange.java @@ -41,6 +41,8 @@ public final class NVVertexArrayRange { public static final int GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = 0x8520; public static final int GL_VERTEX_ARRAY_RANGE_POINTER_NV = 0x8521; + static native void initNativeStubs(); + public static void glVertexArrayRangeNV(ByteBuffer pPointer) { nglVertexArrayRangeNV(pPointer.remaining(), pPointer, pPointer.position()); } @@ -55,8 +57,6 @@ public final class NVVertexArrayRange { private static native void glXFreeMemoryNV(ByteBuffer pointer); - // #ifdef _WIN32 - public static native ByteBuffer wglAllocateMemoryNV( int size, float readFrequency, diff --git a/src/java/org/lwjgl/opengl/NVVertexProgram.java b/src/java/org/lwjgl/opengl/NVVertexProgram.java index ae088f3f..1d7910a4 100644 --- a/src/java/org/lwjgl/opengl/NVVertexProgram.java +++ b/src/java/org/lwjgl/opengl/NVVertexProgram.java @@ -40,467 +40,469 @@ import java.nio.ShortBuffer; public final class NVVertexProgram extends NVProgram { - /* - Accepted by the parameter of Disable, Enable, and IsEnabled, - and by the parameter of GetBooleanv, GetIntegerv, GetFloatv, - and GetDoublev, and by the parameter of BindProgramNV, - ExecuteProgramNV, GetProgramParameter[df]vNV, GetTrackMatrixivNV, - LoadProgramNV, ProgramParameter[s]4[df][v]NV, and TrackMatrixNV: - */ + /* + Accepted by the parameter of Disable, Enable, and IsEnabled, + and by the parameter of GetBooleanv, GetIntegerv, GetFloatv, + and GetDoublev, and by the parameter of BindProgramNV, + ExecuteProgramNV, GetProgramParameter[df]vNV, GetTrackMatrixivNV, + LoadProgramNV, ProgramParameter[s]4[df][v]NV, and TrackMatrixNV: + */ - public static final int GL_VERTEX_PROGRAM_NV = 0x8620; + public static final int GL_VERTEX_PROGRAM_NV = 0x8620; - /* - Accepted by the parameter of Disable, Enable, and IsEnabled, - and by the parameter of GetBooleanv, GetIntegerv, GetFloatv, - and GetDoublev: - */ + /* + Accepted by the parameter of Disable, Enable, and IsEnabled, + and by the parameter of GetBooleanv, GetIntegerv, GetFloatv, + and GetDoublev: + */ - public static final int GL_VERTEX_PROGRAM_POINT_SIZE_NV = 0x8642; + public static final int GL_VERTEX_PROGRAM_POINT_SIZE_NV = 0x8642; - public static final int GL_VERTEX_PROGRAM_TWO_SIDE_NV = 0x8643; + public static final int GL_VERTEX_PROGRAM_TWO_SIDE_NV = 0x8643; - /* - Accepted by the parameter of ExecuteProgramNV and - LoadProgramNV: - */ + /* + Accepted by the parameter of ExecuteProgramNV and + LoadProgramNV: + */ - public static final int GL_VERTEX_STATE_PROGRAM_NV = 0x8621; + public static final int GL_VERTEX_STATE_PROGRAM_NV = 0x8621; - /* - Accepted by the parameter of GetVertexAttrib[dfi]vNV: - */ + /* + Accepted by the parameter of GetVertexAttrib[dfi]vNV: + */ - public static final int GL_ATTRIB_ARRAY_SIZE_NV = 0x8623; + public static final int GL_ATTRIB_ARRAY_SIZE_NV = 0x8623; - public static final int GL_ATTRIB_ARRAY_STRIDE_NV = 0x8624; + public static final int GL_ATTRIB_ARRAY_STRIDE_NV = 0x8624; - public static final int GL_ATTRIB_ARRAY_TYPE_NV = 0x8625; + public static final int GL_ATTRIB_ARRAY_TYPE_NV = 0x8625; - public static final int GL_CURRENT_ATTRIB_NV = 0x8626; + public static final int GL_CURRENT_ATTRIB_NV = 0x8626; - /* - Accepted by the parameter of GetProgramParameterfvNV - and GetProgramParameterdvNV: - */ + /* + Accepted by the parameter of GetProgramParameterfvNV + and GetProgramParameterdvNV: + */ - public static final int GL_PROGRAM_PARAMETER_NV = 0x8644; + public static final int GL_PROGRAM_PARAMETER_NV = 0x8644; - /* - Accepted by the parameter of GetVertexAttribPointervNV: - */ + /* + Accepted by the parameter of GetVertexAttribPointervNV: + */ - public static final int GL_ATTRIB_ARRAY_POINTER_NV = 0x8645; + public static final int GL_ATTRIB_ARRAY_POINTER_NV = 0x8645; - /* - Accepted by the parameter of GetTrackMatrixivNV: - */ + /* + Accepted by the parameter of GetTrackMatrixivNV: + */ - public static final int GL_TRACK_MATRIX_NV = 0x8648; + public static final int GL_TRACK_MATRIX_NV = 0x8648; - public static final int GL_TRACK_MATRIX_TRANSFORM_NV = 0x8649; + public static final int GL_TRACK_MATRIX_TRANSFORM_NV = 0x8649; - /* - 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_TRACK_MATRIX_STACK_DEPTH_NV = 0x862E; + public static final int GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV = 0x862E; - public static final int GL_MAX_TRACK_MATRICES_NV = 0x862F; + public static final int GL_MAX_TRACK_MATRICES_NV = 0x862F; - public static final int GL_CURRENT_MATRIX_STACK_DEPTH_NV = 0x8640; + public static final int GL_CURRENT_MATRIX_STACK_DEPTH_NV = 0x8640; - public static final int GL_CURRENT_MATRIX_NV = 0x8641; + public static final int GL_CURRENT_MATRIX_NV = 0x8641; - public static final int GL_VERTEX_PROGRAM_BINDING_NV = 0x864A; + public static final int GL_VERTEX_PROGRAM_BINDING_NV = 0x864A; - /* - Accepted by the parameter of TrackMatrixNV: - */ + /* + Accepted by the parameter of TrackMatrixNV: + */ - public static final int GL_MODELVIEW_PROJECTION_NV = 0x8629; + public static final int GL_MODELVIEW_PROJECTION_NV = 0x8629; - /* - Accepted by the parameter of TrackMatrixNV and by the - parameter of MatrixMode: - */ + /* + Accepted by the parameter of TrackMatrixNV and by the + parameter of MatrixMode: + */ - public static final int GL_MATRIX0_NV = 0x8630; + public static final int GL_MATRIX0_NV = 0x8630; - public static final int GL_MATRIX1_NV = 0x8631; + public static final int GL_MATRIX1_NV = 0x8631; - public static final int GL_MATRIX2_NV = 0x8632; + public static final int GL_MATRIX2_NV = 0x8632; - public static final int GL_MATRIX3_NV = 0x8633; + public static final int GL_MATRIX3_NV = 0x8633; - public static final int GL_MATRIX4_NV = 0x8634; + public static final int GL_MATRIX4_NV = 0x8634; - public static final int GL_MATRIX5_NV = 0x8635; + public static final int GL_MATRIX5_NV = 0x8635; - public static final int GL_MATRIX6_NV = 0x8636; + public static final int GL_MATRIX6_NV = 0x8636; - public static final int GL_MATRIX7_NV = 0x8637; + public static final int GL_MATRIX7_NV = 0x8637; - /* - Accepted by the parameter of TrackMatrixNV: - */ + /* + Accepted by the parameter of TrackMatrixNV: + */ - public static final int GL_IDENTITY_NV = 0x862A; + public static final int GL_IDENTITY_NV = 0x862A; - public static final int GL_INVERSE_NV = 0x862B; + public static final int GL_INVERSE_NV = 0x862B; - public static final int GL_TRANSPOSE_NV = 0x862C; + public static final int GL_TRANSPOSE_NV = 0x862C; - public static final int GL_INVERSE_TRANSPOSE_NV = 0x862D; + public static final int GL_INVERSE_TRANSPOSE_NV = 0x862D; - /* - Accepted by the parameter of EnableClientState and - DisableClientState, by the parameter of IsEnabled, and by - the parameter of GetBooleanv, GetIntegerv, GetFloatv, and - GetDoublev: - */ + /* + Accepted by the parameter of EnableClientState and + DisableClientState, by the parameter of IsEnabled, and by + the parameter of GetBooleanv, GetIntegerv, GetFloatv, and + GetDoublev: + */ - public static final int GL_VERTEX_ATTRIB_ARRAY0_NV = 0x8650; + public static final int GL_VERTEX_ATTRIB_ARRAY0_NV = 0x8650; - public static final int GL_VERTEX_ATTRIB_ARRAY1_NV = 0x8651; + public static final int GL_VERTEX_ATTRIB_ARRAY1_NV = 0x8651; - public static final int GL_VERTEX_ATTRIB_ARRAY2_NV = 0x8652; + public static final int GL_VERTEX_ATTRIB_ARRAY2_NV = 0x8652; - public static final int GL_VERTEX_ATTRIB_ARRAY3_NV = 0x8653; + public static final int GL_VERTEX_ATTRIB_ARRAY3_NV = 0x8653; - public static final int GL_VERTEX_ATTRIB_ARRAY4_NV = 0x8654; + public static final int GL_VERTEX_ATTRIB_ARRAY4_NV = 0x8654; - public static final int GL_VERTEX_ATTRIB_ARRAY5_NV = 0x8655; + public static final int GL_VERTEX_ATTRIB_ARRAY5_NV = 0x8655; - public static final int GL_VERTEX_ATTRIB_ARRAY6_NV = 0x8656; + public static final int GL_VERTEX_ATTRIB_ARRAY6_NV = 0x8656; - public static final int GL_VERTEX_ATTRIB_ARRAY7_NV = 0x8657; + public static final int GL_VERTEX_ATTRIB_ARRAY7_NV = 0x8657; - public static final int GL_VERTEX_ATTRIB_ARRAY8_NV = 0x8658; + public static final int GL_VERTEX_ATTRIB_ARRAY8_NV = 0x8658; - public static final int GL_VERTEX_ATTRIB_ARRAY9_NV = 0x8659; + public static final int GL_VERTEX_ATTRIB_ARRAY9_NV = 0x8659; - public static final int GL_VERTEX_ATTRIB_ARRAY10_NV = 0x865A; + public static final int GL_VERTEX_ATTRIB_ARRAY10_NV = 0x865A; - public static final int GL_VERTEX_ATTRIB_ARRAY11_NV = 0x865B; + public static final int GL_VERTEX_ATTRIB_ARRAY11_NV = 0x865B; - public static final int GL_VERTEX_ATTRIB_ARRAY12_NV = 0x865C; + public static final int GL_VERTEX_ATTRIB_ARRAY12_NV = 0x865C; - public static final int GL_VERTEX_ATTRIB_ARRAY13_NV = 0x865D; + public static final int GL_VERTEX_ATTRIB_ARRAY13_NV = 0x865D; - public static final int GL_VERTEX_ATTRIB_ARRAY14_NV = 0x865E; + public static final int GL_VERTEX_ATTRIB_ARRAY14_NV = 0x865E; - public static final int GL_VERTEX_ATTRIB_ARRAY15_NV = 0x865F; + public static final int GL_VERTEX_ATTRIB_ARRAY15_NV = 0x865F; - /* - Accepted by the parameter of GetMapdv, GetMapfv, GetMapiv, - Map1d and Map1f and by the parameter of Enable, Disable, and - IsEnabled, and by the parameter of GetBooleanv, GetIntegerv, - GetFloatv, and GetDoublev: - */ + /* + Accepted by the parameter of GetMapdv, GetMapfv, GetMapiv, + Map1d and Map1f and by the parameter of Enable, Disable, and + IsEnabled, and by the parameter of GetBooleanv, GetIntegerv, + GetFloatv, and GetDoublev: + */ - public static final int GL_MAP1_VERTEX_ATTRIB0_4_NV = 0x8660; + public static final int GL_MAP1_VERTEX_ATTRIB0_4_NV = 0x8660; - public static final int GL_MAP1_VERTEX_ATTRIB1_4_NV = 0x8661; + public static final int GL_MAP1_VERTEX_ATTRIB1_4_NV = 0x8661; - public static final int GL_MAP1_VERTEX_ATTRIB2_4_NV = 0x8662; + public static final int GL_MAP1_VERTEX_ATTRIB2_4_NV = 0x8662; - public static final int GL_MAP1_VERTEX_ATTRIB3_4_NV = 0x8663; + public static final int GL_MAP1_VERTEX_ATTRIB3_4_NV = 0x8663; - public static final int GL_MAP1_VERTEX_ATTRIB4_4_NV = 0x8664; + public static final int GL_MAP1_VERTEX_ATTRIB4_4_NV = 0x8664; - public static final int GL_MAP1_VERTEX_ATTRIB5_4_NV = 0x8665; + public static final int GL_MAP1_VERTEX_ATTRIB5_4_NV = 0x8665; - public static final int GL_MAP1_VERTEX_ATTRIB6_4_NV = 0x8666; + public static final int GL_MAP1_VERTEX_ATTRIB6_4_NV = 0x8666; - public static final int GL_MAP1_VERTEX_ATTRIB7_4_NV = 0x8667; + public static final int GL_MAP1_VERTEX_ATTRIB7_4_NV = 0x8667; - public static final int GL_MAP1_VERTEX_ATTRIB8_4_NV = 0x8668; + public static final int GL_MAP1_VERTEX_ATTRIB8_4_NV = 0x8668; - public static final int GL_MAP1_VERTEX_ATTRIB9_4_NV = 0x8669; + public static final int GL_MAP1_VERTEX_ATTRIB9_4_NV = 0x8669; - public static final int GL_MAP1_VERTEX_ATTRIB10_4_NV = 0x866A; + public static final int GL_MAP1_VERTEX_ATTRIB10_4_NV = 0x866A; - public static final int GL_MAP1_VERTEX_ATTRIB11_4_NV = 0x866B; + public static final int GL_MAP1_VERTEX_ATTRIB11_4_NV = 0x866B; - public static final int GL_MAP1_VERTEX_ATTRIB12_4_NV = 0x866C; + public static final int GL_MAP1_VERTEX_ATTRIB12_4_NV = 0x866C; - public static final int GL_MAP1_VERTEX_ATTRIB13_4_NV = 0x866D; + public static final int GL_MAP1_VERTEX_ATTRIB13_4_NV = 0x866D; - public static final int GL_MAP1_VERTEX_ATTRIB14_4_NV = 0x866E; + public static final int GL_MAP1_VERTEX_ATTRIB14_4_NV = 0x866E; - public static final int GL_MAP1_VERTEX_ATTRIB15_4_NV = 0x866F; + public static final int GL_MAP1_VERTEX_ATTRIB15_4_NV = 0x866F; - /* - Accepted by the parameter of GetMapdv, GetMapfv, GetMapiv, - Map2d and Map2f and by the parameter of Enable, Disable, and - IsEnabled, and by the parameter of GetBooleanv, GetIntegerv, - GetFloatv, and GetDoublev: - */ + /* + Accepted by the parameter of GetMapdv, GetMapfv, GetMapiv, + Map2d and Map2f and by the parameter of Enable, Disable, and + IsEnabled, and by the parameter of GetBooleanv, GetIntegerv, + GetFloatv, and GetDoublev: + */ - public static final int GL_MAP2_VERTEX_ATTRIB0_4_NV = 0x8670; + public static final int GL_MAP2_VERTEX_ATTRIB0_4_NV = 0x8670; - public static final int GL_MAP2_VERTEX_ATTRIB1_4_NV = 0x8671; + public static final int GL_MAP2_VERTEX_ATTRIB1_4_NV = 0x8671; - public static final int GL_MAP2_VERTEX_ATTRIB2_4_NV = 0x8672; + public static final int GL_MAP2_VERTEX_ATTRIB2_4_NV = 0x8672; - public static final int GL_MAP2_VERTEX_ATTRIB3_4_NV = 0x8673; + public static final int GL_MAP2_VERTEX_ATTRIB3_4_NV = 0x8673; - public static final int GL_MAP2_VERTEX_ATTRIB4_4_NV = 0x8674; + public static final int GL_MAP2_VERTEX_ATTRIB4_4_NV = 0x8674; - public static final int GL_MAP2_VERTEX_ATTRIB5_4_NV = 0x8675; + public static final int GL_MAP2_VERTEX_ATTRIB5_4_NV = 0x8675; - public static final int GL_MAP2_VERTEX_ATTRIB6_4_NV = 0x8676; + public static final int GL_MAP2_VERTEX_ATTRIB6_4_NV = 0x8676; - public static final int GL_MAP2_VERTEX_ATTRIB7_4_NV = 0x8677; + public static final int GL_MAP2_VERTEX_ATTRIB7_4_NV = 0x8677; - public static final int GL_MAP2_VERTEX_ATTRIB8_4_NV = 0x8678; + public static final int GL_MAP2_VERTEX_ATTRIB8_4_NV = 0x8678; - public static final int GL_MAP2_VERTEX_ATTRIB9_4_NV = 0x8679; + public static final int GL_MAP2_VERTEX_ATTRIB9_4_NV = 0x8679; - public static final int GL_MAP2_VERTEX_ATTRIB10_4_NV = 0x867A; + public static final int GL_MAP2_VERTEX_ATTRIB10_4_NV = 0x867A; - public static final int GL_MAP2_VERTEX_ATTRIB11_4_NV = 0x867B; + public static final int GL_MAP2_VERTEX_ATTRIB11_4_NV = 0x867B; - public static final int GL_MAP2_VERTEX_ATTRIB12_4_NV = 0x867C; + public static final int GL_MAP2_VERTEX_ATTRIB12_4_NV = 0x867C; - public static final int GL_MAP2_VERTEX_ATTRIB13_4_NV = 0x867D; + public static final int GL_MAP2_VERTEX_ATTRIB13_4_NV = 0x867D; - public static final int GL_MAP2_VERTEX_ATTRIB14_4_NV = 0x867E; + public static final int GL_MAP2_VERTEX_ATTRIB14_4_NV = 0x867E; - public static final int GL_MAP2_VERTEX_ATTRIB15_4_NV = 0x867F; + public static final int GL_MAP2_VERTEX_ATTRIB15_4_NV = 0x867F; - // --------------------------- + static native void initNativeStubs(); - public static void glExecuteProgramNV(int target, int id, FloatBuffer params) { - BufferChecks.checkBuffer(params); - nglExecuteProgramNV(target, id, params, params.position()); + // --------------------------- - } + public static void glExecuteProgramNV(int target, int id, FloatBuffer params) { + BufferChecks.checkBuffer(params); + nglExecuteProgramNV(target, id, params, params.position()); - private static native void nglExecuteProgramNV(int target, int id, FloatBuffer params, int paramsOffset); + } - // --------------------------- + private static native void nglExecuteProgramNV(int target, int id, FloatBuffer params, int paramsOffset); - // --------------------------- + // --------------------------- - public static void glGetProgramParameterNV(int target, int index, int parameterName, FloatBuffer params) { - BufferChecks.checkBuffer(params); - nglGetProgramParameterfvNV(target, index, parameterName, params, params.position()); + // --------------------------- - } + public static void glGetProgramParameterNV(int target, int index, int parameterName, FloatBuffer params) { + BufferChecks.checkBuffer(params); + nglGetProgramParameterfvNV(target, index, parameterName, params, params.position()); - private static native void nglGetProgramParameterfvNV( - int target, - int index, - int parameterName, - FloatBuffer params, - int paramsOffset); + } - // --------------------------- + private static native void nglGetProgramParameterfvNV( + int target, + int index, + int parameterName, + FloatBuffer params, + int paramsOffset); - // --------------------------- + // --------------------------- - public static void glGetTrackMatrixNV(int target, int address, int parameterName, IntBuffer params) { - BufferChecks.checkBuffer(params); - nglGetTrackMatrixivNV(target, address, parameterName, params, params.position()); + // --------------------------- - } + public static void glGetTrackMatrixNV(int target, int address, int parameterName, IntBuffer params) { + BufferChecks.checkBuffer(params); + nglGetTrackMatrixivNV(target, address, parameterName, params, params.position()); - private static native void nglGetTrackMatrixivNV( - int target, - int address, - int parameterName, - IntBuffer params, - int paramsOffset); + } - // --------------------------- + private static native void nglGetTrackMatrixivNV( + int target, + int address, + int parameterName, + IntBuffer params, + int paramsOffset); - // --------------------------- + // --------------------------- - public static void glGetVertexAttribNV(int index, int parameterName, FloatBuffer params) { - BufferChecks.checkBuffer(params); - nglGetVertexAttribfvNV(index, parameterName, params, params.position()); + // --------------------------- - } + public static void glGetVertexAttribNV(int index, int parameterName, FloatBuffer params) { + BufferChecks.checkBuffer(params); + nglGetVertexAttribfvNV(index, parameterName, params, params.position()); - private static native void nglGetVertexAttribfvNV(int index, int parameterName, FloatBuffer params, int paramsOffset); + } - // --------------------------- + private static native void nglGetVertexAttribfvNV(int index, int parameterName, FloatBuffer params, int paramsOffset); - // --------------------------- + // --------------------------- - public static void glGetVertexAttribNV(int index, int parameterName, IntBuffer params) { - BufferChecks.checkBuffer(params); - nglGetVertexAttribivNV(index, parameterName, params, params.position()); + // --------------------------- - } + public static void glGetVertexAttribNV(int index, int parameterName, IntBuffer params) { + BufferChecks.checkBuffer(params); + nglGetVertexAttribivNV(index, parameterName, params, params.position()); - private static native void nglGetVertexAttribivNV(int index, int parameterName, IntBuffer params, int paramsOffset); + } - // --------------------------- + private static native void nglGetVertexAttribivNV(int index, int parameterName, IntBuffer params, int paramsOffset); - public static native ByteBuffer glGetVertexAttribPointerNV(int index, int parameterName, int size); + // --------------------------- - public static native void glProgramParameter4fNV(int target, int index, float x, float y, float z, float w); + public static native ByteBuffer glGetVertexAttribPointerNV(int index, int parameterName, int size); - // --------------------------- + public static native void glProgramParameter4fNV(int target, int index, float x, float y, float z, float w); - public static void glProgramParameters4NV(int target, int index, int count, FloatBuffer params) { + // --------------------------- - // Special case buffer check - if (params.remaining() < count * 4) { - throw new BufferOverflowException(); - } + public static void glProgramParameters4NV(int target, int index, int count, FloatBuffer params) { - nglProgramParameters4fvNV(target, index, count, params, params.position()); + // Special case buffer check + if (params.remaining() < count * 4) { + throw new BufferOverflowException(); + } - } + nglProgramParameters4fvNV(target, index, count, params, params.position()); - private static native void nglProgramParameters4fvNV( - int target, - int index, - int count, - FloatBuffer params, - int paramsOffset); + } - // --------------------------- + private static native void nglProgramParameters4fvNV( + int target, + int index, + int count, + FloatBuffer params, + int paramsOffset); - public static native void glTrackMatrixNV(int target, int address, int matrix, int transform); + // --------------------------- - public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, ByteBuffer buffer) { + public static native void glTrackMatrixNV(int target, int address, int matrix, int transform); - BufferChecks.ensureArrayVBOdisabled(); + public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, ByteBuffer buffer) { - nglVertexAttribPointerNV( - index, - size, - unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, - stride, - buffer, - buffer.position()); + BufferChecks.ensureArrayVBOdisabled(); - } + nglVertexAttribPointerNV( + index, + size, + unsigned ? GL11.GL_UNSIGNED_BYTE : GL11.GL_BYTE, + stride, + buffer, + buffer.position()); - public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, ShortBuffer buffer) { + } - BufferChecks.ensureArrayVBOdisabled(); + public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, ShortBuffer buffer) { - nglVertexAttribPointerNV( - index, - size, - unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, - stride, - buffer, - buffer.position() << 1); + BufferChecks.ensureArrayVBOdisabled(); - } + nglVertexAttribPointerNV( + index, + size, + unsigned ? GL11.GL_UNSIGNED_SHORT : GL11.GL_SHORT, + stride, + buffer, + buffer.position() << 1); - public static void glVertexAttribPointerNV(int index, int size, int stride, FloatBuffer buffer) { + } - BufferChecks.ensureArrayVBOdisabled(); + public static void glVertexAttribPointerNV(int index, int size, int stride, FloatBuffer buffer) { - nglVertexAttribPointerNV(index, size, GL11.GL_FLOAT, stride, buffer, buffer.position() << 2); + BufferChecks.ensureArrayVBOdisabled(); - } + nglVertexAttribPointerNV(index, size, GL11.GL_FLOAT, stride, buffer, buffer.position() << 2); - public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, IntBuffer buffer) { + } - BufferChecks.ensureArrayVBOdisabled(); + public static void glVertexAttribPointerNV(int index, int size, boolean unsigned, int stride, IntBuffer buffer) { - nglVertexAttribPointerNV( - index, - size, - unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, - stride, - buffer, - buffer.position() << 2); + BufferChecks.ensureArrayVBOdisabled(); - } + nglVertexAttribPointerNV( + index, + size, + unsigned ? GL11.GL_UNSIGNED_INT : GL11.GL_INT, + stride, + buffer, + buffer.position() << 2); - private static native void nglVertexAttribPointerNV( - int index, - int size, - int type, - int stride, - Buffer buffer, - int bufferOffset); + } - // --------------------------- + private static native void nglVertexAttribPointerNV( + int index, + int size, + int type, + int stride, + Buffer buffer, + int bufferOffset); - public static void glVertexAttribPointerNV(int index, int size, int type, int stride, int bufferOffset) { + // --------------------------- - BufferChecks.ensureArrayVBOenabled(); + public static void glVertexAttribPointerNV(int index, int size, int type, int stride, int bufferOffset) { - nglVertexAttribPointerNVVBO(index, size, type, stride, bufferOffset); + BufferChecks.ensureArrayVBOenabled(); - } + nglVertexAttribPointerNVVBO(index, size, type, stride, bufferOffset); - private static native void nglVertexAttribPointerNVVBO(int index, int size, int type, int stride, int bufferOffset); + } - // --------------------------- + private static native void nglVertexAttribPointerNVVBO(int index, int size, int type, int stride, int bufferOffset); - public static native void glVertexAttrib1sNV(int index, short x); + // --------------------------- - public static native void glVertexAttrib1fNV(int index, float x); + public static native void glVertexAttrib1sNV(int index, short x); - public static native void glVertexAttrib2sNV(int index, short x, short y); + public static native void glVertexAttrib1fNV(int index, float x); - public static native void glVertexAttrib2fNV(int index, float x, float y); + public static native void glVertexAttrib2sNV(int index, short x, short y); - public static native void glVertexAttrib3sNV(int index, short x, short y, short z); + public static native void glVertexAttrib2fNV(int index, float x, float y); - public static native void glVertexAttrib3fNV(int index, float x, float y, float z); + public static native void glVertexAttrib3sNV(int index, short x, short y, short z); - public static native void glVertexAttrib4sNV(int index, short x, short y, short z, short w); + public static native void glVertexAttrib3fNV(int index, float x, float y, float z); - public static native void glVertexAttrib4fNV(int index, float x, float y, float z, float w); + public static native void glVertexAttrib4sNV(int index, short x, short y, short z, short w); - public static native void glVertexAttrib4ubNV(int index, byte x, byte y, byte z, byte w); + public static native void glVertexAttrib4fNV(int index, float x, float y, float z, float w); - public static void glVertexAttribs1NV(int index, int n, ShortBuffer v) { - nglVertexAttribs1svNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs1svNV(int index, int n, ShortBuffer v, int v_offset); + public static native void glVertexAttrib4ubNV(int index, byte x, byte y, byte z, byte w); - public static void glVertexAttribs1NV(int index, int n, FloatBuffer v) { - nglVertexAttribs1fvNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs1fvNV(int index, int n, FloatBuffer v, int v_offset); + public static void glVertexAttribs1NV(int index, int n, ShortBuffer v) { + nglVertexAttribs1svNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs1svNV(int index, int n, ShortBuffer v, int v_offset); - public static void glVertexAttribs2NV(int index, int n, ShortBuffer v) { - nglVertexAttribs2svNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs2svNV(int index, int n, ShortBuffer v, int v_offset); + public static void glVertexAttribs1NV(int index, int n, FloatBuffer v) { + nglVertexAttribs1fvNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs1fvNV(int index, int n, FloatBuffer v, int v_offset); - public static void glVertexAttribs2NV(int index, int n, FloatBuffer v) { - nglVertexAttribs2fvNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs2fvNV(int index, int n, FloatBuffer v, int v_offset); + public static void glVertexAttribs2NV(int index, int n, ShortBuffer v) { + nglVertexAttribs2svNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs2svNV(int index, int n, ShortBuffer v, int v_offset); - public static void glVertexAttribs3NV(int index, int n, ShortBuffer v) { - nglVertexAttribs3svNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs3svNV(int index, int n, ShortBuffer v, int v_offset); + public static void glVertexAttribs2NV(int index, int n, FloatBuffer v) { + nglVertexAttribs2fvNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs2fvNV(int index, int n, FloatBuffer v, int v_offset); - public static void glVertexAttribs3NV(int index, int n, FloatBuffer v) { - nglVertexAttribs3fvNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs3fvNV(int index, int n, FloatBuffer v, int v_offset); + public static void glVertexAttribs3NV(int index, int n, ShortBuffer v) { + nglVertexAttribs3svNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs3svNV(int index, int n, ShortBuffer v, int v_offset); - public static void glVertexAttribs4NV(int index, int n, ShortBuffer v) { - nglVertexAttribs4svNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs4svNV(int index, int n, ShortBuffer v, int v_offset); + public static void glVertexAttribs3NV(int index, int n, FloatBuffer v) { + nglVertexAttribs3fvNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs3fvNV(int index, int n, FloatBuffer v, int v_offset); - public static void glVertexAttribs4NV(int index, int n, FloatBuffer v) { - nglVertexAttribs4fvNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs4fvNV(int index, int n, FloatBuffer v, int v_offset); + public static void glVertexAttribs4NV(int index, int n, ShortBuffer v) { + nglVertexAttribs4svNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs4svNV(int index, int n, ShortBuffer v, int v_offset); - public static void glVertexAttribs4uNV(int index, int n, ByteBuffer v) { - nglVertexAttribs4ubvNV(index, n, v, v.position()); - } - private static native void nglVertexAttribs4ubvNV(int index, int n, ByteBuffer v, int v_offset); + public static void glVertexAttribs4NV(int index, int n, FloatBuffer v) { + nglVertexAttribs4fvNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs4fvNV(int index, int n, FloatBuffer v, int v_offset); + + public static void glVertexAttribs4uNV(int index, int n, ByteBuffer v) { + nglVertexAttribs4ubvNV(index, n, v, v.position()); + } + private static native void nglVertexAttribs4ubvNV(int index, int n, ByteBuffer v, int v_offset); } diff --git a/src/java/org/lwjgl/opengl/Pbuffer.java b/src/java/org/lwjgl/opengl/Pbuffer.java index e8d98ae0..2d473137 100644 --- a/src/java/org/lwjgl/opengl/Pbuffer.java +++ b/src/java/org/lwjgl/opengl/Pbuffer.java @@ -207,17 +207,18 @@ public final class Pbuffer { /** * Method to make the Pbuffer context current. All subsequent OpenGL calls will go to this buffer. + * @throws LWJGLException of the context could not be made current */ - public synchronized void makeCurrent() { + public synchronized void makeCurrent() throws LWJGLException { currentBuffer = this; nMakeCurrent(handle); - VBOTracker.setCurrent(this); + GLContext.useContext(this); } /** * Native method to make a pbuffer current. */ - private static native void nMakeCurrent(int handle); + private static native void nMakeCurrent(int handle) throws LWJGLException; /** * Gets the Pbuffer capabilities. @@ -238,12 +239,17 @@ public final class Pbuffer { * the current rendering context or not. */ public synchronized void destroy() { - makeCurrent(); - int error = GL11.glGetError(); VBOTracker.remove(this); - nDestroy(handle); - if (error != GL11.GL_NO_ERROR) - throw new OpenGLException(error); + try { + makeCurrent(); + int error = GL11.glGetError(); + nDestroy(handle); + GLContext.useContext(null); + if (error != GL11.GL_NO_ERROR) + throw new OpenGLException(error); + } catch (LWJGLException e) { + // ignore exception + } } /** diff --git a/src/java/org/lwjgl/test/opengl/PbufferTest.java b/src/java/org/lwjgl/test/opengl/PbufferTest.java index 39879f04..1be0886a 100644 --- a/src/java/org/lwjgl/test/opengl/PbufferTest.java +++ b/src/java/org/lwjgl/test/opengl/PbufferTest.java @@ -35,6 +35,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; +import org.lwjgl.LWJGLException; import org.lwjgl.opengl.PixelFormat; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; @@ -176,7 +177,11 @@ public class PbufferTest { pbuffer.destroy(); initPbuffer(); } - pbuffer.makeCurrent(); + try { + pbuffer.makeCurrent(); + } catch (LWJGLException e) { + throw new RuntimeException(e); + } // Pbuffer rendering //clear background GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); @@ -198,7 +203,11 @@ public class PbufferTest { } GL11.glPopMatrix(); GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, 512, 512, 0); - Display.makeCurrent(); + try { + Display.makeCurrent(); + } catch (LWJGLException e) { + throw new RuntimeException(e); + } // OpenGL window rendering GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBBufferObject.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBBufferObject.cpp index 6ceb0cf8..e92d9685 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBBufferObject.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBBufferObject.cpp @@ -199,8 +199,8 @@ static jobject JNICALL Java_org_lwjgl_opengl_ARBBufferObject_glGetBufferPointerA return safeNewBuffer(env, pointer, size); } -void extgl_InitARBBufferObject(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBBufferObject_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"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}, @@ -216,7 +216,7 @@ void extgl_InitARBBufferObject(JNIEnv *env, jobject ext_set) }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBBufferObject"); - - extgl_InitializeClass(env, clazz, NULL, "", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBImaging.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBImaging.cpp index 63a4ae4a..eb462fd7 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBImaging.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBImaging.cpp @@ -546,8 +546,8 @@ static void JNICALL Java_org_lwjgl_opengl_ARBImaging_nglGetSeparableFilter } -void extgl_InitARBImaging(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBImaging_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglColorTable", "(IIIIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBImaging_nglColorTable, "glColorTable", (void**)&glColorTable}, {"nglColorSubTable", "(IIIIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBImaging_nglColorSubTable, "glColorSubTable", (void**)&glColorSubTable}, @@ -585,8 +585,7 @@ void extgl_InitARBImaging(JNIEnv *env, jobject ext_set) {"nglGetSeparableFilter", "(IIILjava/nio/Buffer;ILjava/nio/Buffer;ILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBImaging_nglGetSeparableFilter, "glGetSeparableFilter", (void**)&glGetSeparableFilter} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBImaging"); - if (extgl_Extensions.GL_ARB_imaging) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_imaging", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBMatrixPalette.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBMatrixPalette.cpp index c7873c94..58a7c096 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBMatrixPalette.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBMatrixPalette.cpp @@ -119,8 +119,8 @@ static void JNICALL Java_org_lwjgl_opengl_ARBMatrixPalette_nglMatrixIndexusvARB } -void extgl_InitARBMatrixPalette(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBMatrixPalette_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glCurrentPaletteMatrixARB", "(I)V", (void*)&Java_org_lwjgl_opengl_ARBMatrixPalette_glCurrentPaletteMatrixARB, "glCurrentPaletteMatrixARB", (void**)&glCurrentPaletteMatrixARB}, {"nglMatrixIndexPointerARB", "(IIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBMatrixPalette_nglMatrixIndexPointerARB, "glMatrixIndexPointerARB", (void**)&glMatrixIndexPointerARB}, @@ -130,8 +130,7 @@ void extgl_InitARBMatrixPalette(JNIEnv *env, jobject ext_set) {"nglMatrixIndexusvARB", "(ILjava/nio/ShortBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBMatrixPalette_nglMatrixIndexusvARB, "glMatrixIndexusvARB", (void**)&glMatrixIndexusvARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBMatrixPalette"); - if (extgl_Extensions.GL_ARB_matrix_palette) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_matrix_palette", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBMultisample.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBMultisample.cpp index e7c60f6b..711d4816 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBMultisample.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBMultisample.cpp @@ -52,14 +52,13 @@ static void JNICALL Java_org_lwjgl_opengl_ARBMultisample_glSampleCoverageARB } -void extgl_InitARBMultisample(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBMultisample_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glSampleCoverageARB", "(FZ)V", (void*)&Java_org_lwjgl_opengl_ARBMultisample_glSampleCoverageARB, "glSampleCoverageARB", (void**)&glSampleCoverageARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBMultisample"); - if (extgl_Extensions.GL_ARB_multisample) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_multisample", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBMultitexture.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBMultitexture.cpp index d102a23e..31d8b7ca 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBMultitexture.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBMultitexture.cpp @@ -221,8 +221,8 @@ static void JNICALL Java_org_lwjgl_opengl_ARBMultitexture_glMultiTexCoord4sARB } -void extgl_InitARBMultitexture(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBMultitexture_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glClientActiveTextureARB", "(I)V", (void*)&Java_org_lwjgl_opengl_ARBMultitexture_glClientActiveTextureARB, "glClientActiveTextureARB", (void**)&glClientActiveTextureARB}, {"glActiveTextureARB", "(I)V", (void*)&Java_org_lwjgl_opengl_ARBMultitexture_glActiveTextureARB, "glActiveTextureARB", (void**)&glActiveTextureARB}, @@ -240,8 +240,7 @@ void extgl_InitARBMultitexture(JNIEnv *env, jobject ext_set) {"glMultiTexCoord4sARB", "(ISSSS)V", (void*)&Java_org_lwjgl_opengl_ARBMultitexture_glMultiTexCoord4sARB, "glMultiTexCoord4sARB", (void**)&glMultiTexCoord4sARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBMultitexture"); - if (extgl_Extensions.GL_ARB_multitexture) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_multitexture", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBOcclusionQuery.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBOcclusionQuery.cpp index db0f1647..727a5b9e 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBOcclusionQuery.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBOcclusionQuery.cpp @@ -149,8 +149,8 @@ static void JNICALL Java_org_lwjgl_opengl_ARBOcclusionQuery_nglGetQueryObjectuiv } -void extgl_InitARBOcclusionQuery(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBOcclusionQuery_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglGenQueriesARB", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBOcclusionQuery_nglGenQueriesARB, "glGenQueriesARB", (void**)&glGenQueriesARB}, {"nglDeleteQueriesARB", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBOcclusionQuery_nglDeleteQueriesARB, "glDeleteQueriesARB", (void**)&glDeleteQueriesARB}, @@ -162,8 +162,7 @@ void extgl_InitARBOcclusionQuery(JNIEnv *env, jobject ext_set) {"nglGetQueryObjectuivARB", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBOcclusionQuery_nglGetQueryObjectuivARB, "glGetQueryObjectuivARB", (void**)&glGetQueryObjectuivARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBOcclusionQuery"); - if (extgl_Extensions.GL_ARB_occlusion_query) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_occlusion_query", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBPointParameters.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBPointParameters.cpp index ce3a30fb..19debf76 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBPointParameters.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBPointParameters.cpp @@ -66,15 +66,14 @@ static void JNICALL Java_org_lwjgl_opengl_ARBPointParameters_nglPointParameterfv } -void extgl_InitARBPointParameters(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBPointParameters_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glPointParameterfARB", "(IF)V", (void*)&Java_org_lwjgl_opengl_ARBPointParameters_glPointParameterfARB, "glPointParameterfARB", (void**)&glPointParameterfARB}, {"nglPointParameterfvARB", "(ILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBPointParameters_nglPointParameterfvARB, "glPointParameterfvARB", (void**)&glPointParameterfvARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBPointParameters"); - if (extgl_Extensions.GL_ARB_point_parameters) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_point_parameters", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBProgram.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBProgram.cpp index d0d85c13..4b8f1812 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBProgram.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBProgram.cpp @@ -219,8 +219,8 @@ static jboolean JNICALL Java_org_lwjgl_opengl_ARBProgram_glIsProgramARB return result; } -void extgl_InitARBProgram(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBProgram_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglProgramStringARB", "(IIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBProgram_nglProgramStringARB, "glProgramStringARB", (void**)&glProgramStringARB}, {"glBindProgramARB", "(II)V", (void*)&Java_org_lwjgl_opengl_ARBProgram_glBindProgramARB, "glBindProgramARB", (void**)&glBindProgramARB}, @@ -237,7 +237,7 @@ void extgl_InitARBProgram(JNIEnv *env, jobject ext_set) {"glIsProgramARB", "(I)Z", (void*)&Java_org_lwjgl_opengl_ARBProgram_glIsProgramARB, "glIsProgramARB", (void**)&glIsProgramARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBProgram"); - extgl_InitializeClass(env, clazz, NULL, NULL, num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBShaderObjects.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBShaderObjects.cpp index 840b3706..8c7d66bf 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBShaderObjects.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBShaderObjects.cpp @@ -645,8 +645,8 @@ static void JNICALL Java_org_lwjgl_opengl_ARBShaderObjects_nglGetShaderSourceARB } -void extgl_InitARBShaderObjects(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBShaderObjects_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glDeleteObjectARB", "(I)V", (void*)&Java_org_lwjgl_opengl_ARBShaderObjects_glDeleteObjectARB, "glDeleteObjectARB", (void**)&glDeleteObjectARB}, {"glGetHandleARB", "(I)I", (void*)&Java_org_lwjgl_opengl_ARBShaderObjects_glGetHandleARB, "glGetHandleARB", (void**)&glGetHandleARB}, @@ -691,8 +691,7 @@ void extgl_InitARBShaderObjects(JNIEnv *env, jobject ext_set) {"nglGetShaderSourceARB", "(IILjava/nio/IntBuffer;ILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBShaderObjects_nglGetShaderSourceARB, "glGetShaderSourceARB", (void**)&glGetShaderSourceARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBShaderObjects"); - if (extgl_Extensions.GL_ARB_shader_objects) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_shader_objects", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBTextureCompression.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBTextureCompression.cpp index f6601e84..7bd33840 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBTextureCompression.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBTextureCompression.cpp @@ -137,8 +137,8 @@ static void JNICALL Java_org_lwjgl_opengl_ARBTextureCompression_nglGetCompressed } -void extgl_InitARBTextureCompression(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBTextureCompression_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglCompressedTexImage1DARB", "(IIIIIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBTextureCompression_nglCompressedTexImage1DARB, "glCompressedTexImage1DARB", (void**)&glCompressedTexImage1DARB}, {"nglCompressedTexImage2DARB", "(IIIIIIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBTextureCompression_nglCompressedTexImage2DARB, "glCompressedTexImage2DARB", (void**)&glCompressedTexImage2DARB}, @@ -149,8 +149,6 @@ void extgl_InitARBTextureCompression(JNIEnv *env, jobject ext_set) {"nglGetCompressedTexImageARB", "(IILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBTextureCompression_nglGetCompressedTexImageARB, "glGetCompressedTexImageARB", (void**)&glGetCompressedTexImageARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBTextureCompression"); - if (extgl_Extensions.GL_ARB_texture_compression) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_texture_compression", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } - diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBTransposeMatrix.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBTransposeMatrix.cpp index 5a774723..200b962b 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBTransposeMatrix.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBTransposeMatrix.cpp @@ -67,15 +67,14 @@ static void JNICALL Java_org_lwjgl_opengl_ARBTransposeMatrix_nglMultTransposeMat } -void extgl_InitARBTransposeMatrix(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBTransposeMatrix_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglLoadTransposeMatrixfARB", "(Ljava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBTransposeMatrix_nglLoadTransposeMatrixfARB, "glLoadTransposeMatrixfARB", (void**)&glLoadTransposeMatrixfARB}, {"nglMultTransposeMatrixfARB", "(Ljava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBTransposeMatrix_nglMultTransposeMatrixfARB, "glMultTransposeMatrixfARB", (void**)&glMultTransposeMatrixfARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBTransposeMatrix"); - if (extgl_Extensions.GL_ARB_transpose_matrix) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_transpose_matrix", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBVertexBlend.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBVertexBlend.cpp index f07ed7dc..17c5651e 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBVertexBlend.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBVertexBlend.cpp @@ -175,8 +175,8 @@ static void JNICALL Java_org_lwjgl_opengl_ARBVertexBlend_glVertexBlendARB } -void extgl_InitARBVertexBlend(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBVertexBlend_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglWeightbvARB", "(ILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBlend_nglWeightbvARB, "glWeightbvARB", (void**)&glWeightbvARB}, {"nglWeightfvARB", "(ILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBlend_nglWeightfvARB, "glWeightfvARB", (void**)&glWeightfvARB}, @@ -190,8 +190,7 @@ void extgl_InitARBVertexBlend(JNIEnv *env, jobject ext_set) {"glVertexBlendARB", "(I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexBlend_glVertexBlendARB, "glVertexBlendARB", (void**)&glVertexBlendARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBVertexBlend"); - if (extgl_Extensions.GL_ARB_vertex_blend) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_vertex_blend", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBVertexProgram.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBVertexProgram.cpp index 51eadf9f..bb863a2f 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBVertexProgram.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBVertexProgram.cpp @@ -273,8 +273,8 @@ static jobject JNICALL Java_org_lwjgl_opengl_ARBVertexProgram_glGetVertexAttribP return safeNewBuffer(env, address, size); } -void extgl_InitARBVertexProgram(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBVertexProgram_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glVertexAttrib1sARB", "(IS)V", (void*)&Java_org_lwjgl_opengl_ARBVertexProgram_glVertexAttrib1sARB, "glVertexAttrib1sARB", (void**)&glVertexAttrib1sARB}, {"glVertexAttrib1fARB", "(IF)V", (void*)&Java_org_lwjgl_opengl_ARBVertexProgram_glVertexAttrib1fARB, "glVertexAttrib1fARB", (void**)&glVertexAttrib1fARB}, @@ -294,8 +294,7 @@ void extgl_InitARBVertexProgram(JNIEnv *env, jobject ext_set) {"glGetVertexAttribPointerARB", "(III)Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_opengl_ARBVertexProgram_glGetVertexAttribPointerARB, "glGetVertexAttribPointervARB", (void**)&glGetVertexAttribPointervARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBVertexProgram"); - if (extgl_Extensions.GL_ARB_vertex_program) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_vertex_program", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBVertexShader.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBVertexShader.cpp index 893d7ff4..234457d4 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBVertexShader.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBVertexShader.cpp @@ -95,16 +95,15 @@ static jint JNICALL Java_org_lwjgl_opengl_ARBVertexShader_nglGetAttribLocationAR return result; } -void extgl_InitARBVertexShader(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBVertexShader_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglBindAttribLocationARB", "(IILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexShader_nglBindAttribLocationARB, "glBindAttribLocationARB", (void**)&glBindAttribLocationARB}, {"nglGetActiveAttribARB", "(IIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ARBVertexShader_nglGetActiveAttribARB, "glGetActiveAttribARB", (void**)&glGetActiveAttribARB}, {"nglGetAttribLocationARB", "(ILjava/nio/ByteBuffer;I)I", (void*)&Java_org_lwjgl_opengl_ARBVertexShader_nglGetAttribLocationARB, "glGetAttribLocationARB", (void**)&glGetAttribLocationARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBVertexShader"); - if (extgl_Extensions.GL_ARB_vertex_shader) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_vertex_shader", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/arb/org_lwjgl_opengl_ARBWindowPos.cpp b/src/native/common/arb/org_lwjgl_opengl_ARBWindowPos.cpp index d63c5cfe..b6348031 100644 --- a/src/native/common/arb/org_lwjgl_opengl_ARBWindowPos.cpp +++ b/src/native/common/arb/org_lwjgl_opengl_ARBWindowPos.cpp @@ -117,8 +117,8 @@ static void JNICALL Java_org_lwjgl_opengl_ARBWindowPos_glWindowPos3sARB } -void extgl_InitARBWindowPos(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBWindowPos_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glWindowPos2fARB", "(FF)V", (void*)&Java_org_lwjgl_opengl_ARBWindowPos_glWindowPos2fARB, "glWindowPos2fARB", (void**)&glWindowPos2fARB}, {"glWindowPos2iARB", "(II)V", (void*)&Java_org_lwjgl_opengl_ARBWindowPos_glWindowPos2iARB, "glWindowPos2iARB", (void**)&glWindowPos2iARB}, @@ -128,8 +128,7 @@ void extgl_InitARBWindowPos(JNIEnv *env, jobject ext_set) {"glWindowPos3sARB", "(SSS)V", (void*)&Java_org_lwjgl_opengl_ARBWindowPos_glWindowPos3sARB, "glWindowPos3sARB", (void**)&glWindowPos3sARB} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ARBWindowPos"); - if (extgl_Extensions.GL_ARB_window_pos) - extgl_InitializeClass(env, clazz, ext_set, "GL_ARB_window_pos", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIDrawBuffers.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIDrawBuffers.cpp index 96743dd4..d5abc787 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIDrawBuffers.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIDrawBuffers.cpp @@ -53,13 +53,13 @@ static void JNICALL Java_org_lwjgl_opengl_ATIDrawBuffers_nglDrawBuffersATI } -void extgl_InitATIDrawBuffers(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIDrawBuffers_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglDrawBuffersATI", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIDrawBuffers_nglDrawBuffersATI, "glDrawBuffersATI", (void**)&glDrawBuffersATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIDrawBuffers"); - if (extgl_Extensions.GL_ATI_draw_buffers) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_draw_buffers", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIElementArray.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIElementArray.cpp index 42396f9b..42baf4d2 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIElementArray.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIElementArray.cpp @@ -90,8 +90,8 @@ static void JNICALL Java_org_lwjgl_opengl_ATIElementArray_glDrawRangeElementArra } -void extgl_InitATIElementArray(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIElementArray_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglElementPointerATI", "(ILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIElementArray_nglElementPointerATI, "glElementPointerATI", (void**)&glElementPointerATI}, {"nglElementPointerATIVBO", "(II)V", (void*)&Java_org_lwjgl_opengl_ATIElementArray_nglElementPointerATIVBO, NULL, NULL}, @@ -99,7 +99,7 @@ void extgl_InitATIElementArray(JNIEnv *env, jobject ext_set) {"glDrawRangeElementArrayATI", "(IIII)V", (void*)&Java_org_lwjgl_opengl_ATIElementArray_glDrawRangeElementArrayATI, "glDrawRangeElementArrayATI", (void**)&glDrawRangeElementArrayATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIElementArray"); - if (extgl_Extensions.GL_ATI_element_array) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_element_array", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIEnvmapBumpmap.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIEnvmapBumpmap.cpp index 95b2cf2a..6f163612 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIEnvmapBumpmap.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIEnvmapBumpmap.cpp @@ -95,8 +95,8 @@ static void JNICALL Java_org_lwjgl_opengl_ATIEnvmapBumpmap_nglGetTexBumpParamete } -void extgl_InitATIEnvmapBumpmap(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIEnvmapBumpmap_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglTexBumpParameterfvATI", "(ILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIEnvmapBumpmap_nglTexBumpParameterfvATI, "glTexBumpParameterfvATI", (void**)&glTexBumpParameterfvATI}, {"nglTexBumpParameterivATI", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIEnvmapBumpmap_nglTexBumpParameterivATI, "glTexBumpParameterivATI", (void**)&glTexBumpParameterivATI}, @@ -104,7 +104,7 @@ void extgl_InitATIEnvmapBumpmap(JNIEnv *env, jobject ext_set) {"nglGetTexBumpParameterivATI", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIEnvmapBumpmap_nglGetTexBumpParameterivATI, "glGetTexBumpParameterivATI", (void**)&glGetTexBumpParameterivATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIEnvmapBumpmap"); - if (extgl_Extensions.GL_ATI_envmap_bumpmap) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_envmap_bumpmap", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIFragmentShader.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIFragmentShader.cpp index 92b81b89..386d7c37 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIFragmentShader.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIFragmentShader.cpp @@ -223,8 +223,8 @@ static void JNICALL Java_org_lwjgl_opengl_ATIFragmentShader_nglSetFragmentShader } -void extgl_InitATIFragmentShader(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIFragmentShader_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glGenFragmentShadersATI", "(I)I", (void*)&Java_org_lwjgl_opengl_ATIFragmentShader_glGenFragmentShadersATI, "glGenFragmentShadersATI", (void**)&glGenFragmentShadersATI}, {"glBindFragmentShaderATI", "(I)V", (void*)&Java_org_lwjgl_opengl_ATIFragmentShader_glBindFragmentShaderATI, "glBindFragmentShaderATI", (void**)&glBindFragmentShaderATI}, @@ -242,7 +242,7 @@ void extgl_InitATIFragmentShader(JNIEnv *env, jobject ext_set) {"nglSetFragmentShaderConstantATI", "(ILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIFragmentShader_nglSetFragmentShaderConstantATI, "glSetFragmentShaderConstantATI", (void**)&glSetFragmentShaderConstantATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIFragmentShader"); - if (extgl_Extensions.GL_ATI_fragment_shader) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_fragment_shader", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIMapObjectBuffer.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIMapObjectBuffer.cpp index 4c423eef..2f011251 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIMapObjectBuffer.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIMapObjectBuffer.cpp @@ -72,14 +72,13 @@ static void JNICALL Java_org_lwjgl_opengl_ATIMapObjectBuffer_glUnmapObjectBuffer } -void extgl_InitATIMapObjectBuffer(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIMapObjectBuffer_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glMapObjectBufferATI", "(IILjava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_opengl_ATIMapObjectBuffer_glMapObjectBufferATI, "glMapObjectBufferATI", (void**)&glMapObjectBufferATI}, {"glUnmapObjectBufferATI", "(I)V", (void*)&Java_org_lwjgl_opengl_ATIMapObjectBuffer_glUnmapObjectBufferATI, "glUnmapObjectBufferATI", (void**)&glUnmapObjectBufferATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIMapObjectBuffer"); - if (extgl_Extensions.GL_ATI_map_object_buffer) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_map_object_buffer", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIPnTriangles.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIPnTriangles.cpp index 4e5a415c..588769bd 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIPnTriangles.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIPnTriangles.cpp @@ -65,14 +65,14 @@ static void JNICALL Java_org_lwjgl_opengl_ATIPnTriangles_glPNTrianglesiATI } -void extgl_InitATIPNTriangles(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIPnTriangles_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glPNTrianglesfATI", "(IF)V", (void*)&Java_org_lwjgl_opengl_ATIPnTriangles_glPNTrianglesfATI, "glPNTrianglesfATI", (void**)&glPNTrianglesfATI}, {"glPNTrianglesiATI", "(II)V", (void*)&Java_org_lwjgl_opengl_ATIPnTriangles_glPNTrianglesiATI, "glPNTrianglesiATI", (void**)&glPNTrianglesiATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIPnTriangles"); - if (extgl_Extensions.GL_ATI_pn_triangles) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_pn_triangles", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ati/org_lwjgl_opengl_ATISeparateStencil.cpp b/src/native/common/ati/org_lwjgl_opengl_ATISeparateStencil.cpp index 948ca0b3..5b3d1cb1 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATISeparateStencil.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATISeparateStencil.cpp @@ -65,14 +65,14 @@ static void JNICALL Java_org_lwjgl_opengl_ATISeparateStencil_glStencilFuncSepara } -void extgl_InitATISeparateStencil(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATISeparateStencil_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glStencilOpSeparateATI", "(IIII)V", (void*)&Java_org_lwjgl_opengl_ATISeparateStencil_glStencilOpSeparateATI, "glStencilOpSeparateATI", (void**)&glStencilOpSeparateATI}, {"glStencilFuncSeparateATI", "(IIII)V", (void*)&Java_org_lwjgl_opengl_ATISeparateStencil_glStencilFuncSeparateATI, "glStencilFuncSeparateATI", (void**)&glStencilFuncSeparateATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATISeparateStencil"); - if (extgl_Extensions.GL_ATI_separate_stencil) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_separate_stencil", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIVertexArrayObject.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIVertexArrayObject.cpp index aae8d02a..06f42d4c 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIVertexArrayObject.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIVertexArrayObject.cpp @@ -205,8 +205,8 @@ static void JNICALL Java_org_lwjgl_opengl_ATIVertexArrayObject_nglGetVariantArra } -void extgl_InitATIVertexArrayObject(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIVertexArrayObject_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglNewObjectBufferATI", "(ILjava/nio/Buffer;II)I", (void*)&Java_org_lwjgl_opengl_ATIVertexArrayObject_nglNewObjectBufferATI, "glNewObjectBufferATI", (void**)&glNewObjectBufferATI}, {"glIsObjectBufferATI", "(I)Z", (void*)&Java_org_lwjgl_opengl_ATIVertexArrayObject_glIsObjectBufferATI, "glIsObjectBufferATI", (void**)&glIsObjectBufferATI}, @@ -222,7 +222,7 @@ void extgl_InitATIVertexArrayObject(JNIEnv *env, jobject ext_set) {"nglGetVariantArrayObjectivATI", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIVertexArrayObject_nglGetVariantArrayObjectivATI, "glGetVariantArrayObjectivATI", (void**)&glGetVariantArrayObjectivATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIVertexArrayObject"); - if (extgl_Extensions.GL_ATI_vertex_array_object) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_vertex_array_object", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIVertexAttribArrayObject.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIVertexAttribArrayObject.cpp index a6cdab57..1088cb17 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIVertexAttribArrayObject.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIVertexAttribArrayObject.cpp @@ -80,15 +80,15 @@ static void JNICALL Java_org_lwjgl_opengl_ATIVertexAttribArrayObject_nglGetVerte } -void extgl_InitATIVertexAttribArrayObject(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIVertexAttribArrayObject_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glVertexAttribArrayObjectATI", "(IIIZIII)V", (void*)&Java_org_lwjgl_opengl_ATIVertexAttribArrayObject_glVertexAttribArrayObjectATI, "glVertexAttribArrayObjectATI", (void**)&glVertexAttribArrayObjectATI}, {"nglGetVertexAttribArrayObjectfvATI", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIVertexAttribArrayObject_nglGetVertexAttribArrayObjectfvATI, "glGetVertexAttribArrayObjectfvATI", (void**)&glGetVertexAttribArrayObjectfvATI}, {"nglGetVertexAttribArrayObjectivATI", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_ATIVertexAttribArrayObject_nglGetVertexAttribArrayObjectivATI, "glGetVertexAttribArrayObjectivATI", (void**)&glGetVertexAttribArrayObjectivATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIVertexAttribArrayObject"); - if (extgl_Extensions.GL_ATI_vertex_attrib_array_object) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_vertex_attrib_array_object", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ati/org_lwjgl_opengl_ATIVertexStreams.cpp b/src/native/common/ati/org_lwjgl_opengl_ATIVertexStreams.cpp index f0569184..e0e1680e 100644 --- a/src/native/common/ati/org_lwjgl_opengl_ATIVertexStreams.cpp +++ b/src/native/common/ati/org_lwjgl_opengl_ATIVertexStreams.cpp @@ -286,8 +286,8 @@ static void JNICALL Java_org_lwjgl_opengl_ATIVertexStreams_glVertexBlendEnviATI } -void extgl_InitATIVertexStreams(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ATIVertexStreams_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glVertexStream1fATI", "(IF)V", (void*)&Java_org_lwjgl_opengl_ATIVertexStreams_glVertexStream1fATI, "glVertexStream1fATI", (void**)&glVertexStream1fATI}, {"glVertexStream1iATI", "(II)V", (void*)&Java_org_lwjgl_opengl_ATIVertexStreams_glVertexStream1iATI, "glVertexStream1iATI", (void**)&glVertexStream1iATI}, @@ -310,7 +310,7 @@ void extgl_InitATIVertexStreams(JNIEnv *env, jobject ext_set) {"glVertexBlendEnviATI", "(II)V", (void*)&Java_org_lwjgl_opengl_ATIVertexStreams_glVertexBlendEnviATI, "glVertexBlendEnviATI", (void**)&glVertexBlendEnviATI} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/ATIVertexStreams"); - if (extgl_Extensions.GL_ATI_vertex_streams) - extgl_InitializeClass(env, clazz, ext_set, "GL_ATI_vertex_streams", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/common_tools.cpp b/src/native/common/common_tools.cpp index 8b3d7259..8fd0b625 100644 --- a/src/native/common/common_tools.cpp +++ b/src/native/common/common_tools.cpp @@ -195,6 +195,7 @@ bool ext_InitializeClass(JNIEnv *env, jclass clazz, jobject ext_set, const char ext_removeExtension(env, ext_set, ext_name); } free(methods); + throwException(env, "Missing driver symbols"); return false; } void **ext_function_pointer_pointer = function->ext_function_pointer; diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTBlendEquationSeparate.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTBlendEquationSeparate.cpp index dd87d7a2..c53beac0 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTBlendEquationSeparate.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTBlendEquationSeparate.cpp @@ -50,13 +50,13 @@ static void JNICALL Java_org_lwjgl_opengl_EXTBlendEquationSeparate_glBlendEquati glBlendEquationSeparateEXT(modeRGB, modeAlpha); } -void extgl_InitEXTBlendEquationSeparate(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTBlendEquationSeparate_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glBlendEquationSeparateEXT", "(II)V", (void*)&Java_org_lwjgl_opengl_EXTBlendEquationSeparate_glBlendEquationSeparateEXT, "glBlendEquationSeparateEXT", (void**)&glBlendEquationSeparateEXT} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTBlendEquationSeparate"); - if (extgl_Extensions.GL_EXT_blend_equation_separate) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_blend_equation_separate", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTBlendFuncSeparate.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTBlendFuncSeparate.cpp index 14c22935..2f53955d 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTBlendFuncSeparate.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTBlendFuncSeparate.cpp @@ -52,14 +52,13 @@ static void JNICALL Java_org_lwjgl_opengl_EXTBlendFuncSeparate_glBlendFuncSepara } -void extgl_InitEXTBlendFuncSeparate(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTBlendFuncSeparate_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glBlendFuncSeparateEXT", "(IIII)V", (void*)&Java_org_lwjgl_opengl_EXTBlendFuncSeparate_glBlendFuncSeparateEXT, "glBlendFuncSeparateEXT", (void**)&glBlendFuncSeparateEXT} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTBlendFuncSeparate"); - if (extgl_Extensions.GL_EXT_blend_func_separate) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_blend_func_separate", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTCompiledVertexArray.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTCompiledVertexArray.cpp index 46dce626..4734820d 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTCompiledVertexArray.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTCompiledVertexArray.cpp @@ -65,15 +65,14 @@ static void JNICALL Java_org_lwjgl_opengl_EXTCompiledVertexArray_glUnlockArraysE } -void extgl_InitEXTCompiledVertexArray(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTCompiledVertexArray_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glLockArraysEXT", "(II)V", (void*)&Java_org_lwjgl_opengl_EXTCompiledVertexArray_glLockArraysEXT, "glLockArraysEXT", (void**)&glLockArraysEXT}, {"glUnlockArraysEXT", "()V", (void*)&Java_org_lwjgl_opengl_EXTCompiledVertexArray_glUnlockArraysEXT, "glUnlockArraysEXT", (void**)&glUnlockArraysEXT} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTCompiledVertexArray"); - if (extgl_Extensions.GL_EXT_compiled_vertex_array) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_compiled_vertex_array", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTDepthBoundsTest.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTDepthBoundsTest.cpp index e6595b64..93376832 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTDepthBoundsTest.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTDepthBoundsTest.cpp @@ -50,13 +50,13 @@ static void JNICALL Java_org_lwjgl_opengl_EXTDepthBoundsTest_glDepthBoundsEXT glDepthBoundsEXT(zmin, zmax); } -void extgl_InitEXTDepthBoundsTest(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTDepthBoundsTest_initNativeStubs(JNIEnv *env, jclass clazz) { 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); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTDrawRangeElements.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTDrawRangeElements.cpp index e16c9655..bc6c434c 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTDrawRangeElements.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTDrawRangeElements.cpp @@ -64,15 +64,14 @@ static void JNICALL Java_org_lwjgl_opengl_EXTDrawRangeElements_nglDrawRangeEleme } -void extgl_InitEXTDrawRangeElements(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTDrawRangeElements_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglDrawRangeElementsEXT", "(IIIIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_EXTDrawRangeElements_nglDrawRangeElementsEXT, "glDrawRangeElementsEXT", (void**)&glDrawRangeElementsEXT}, {"nglDrawRangeElementsEXTVBO", "(IIIIII)V", (void*)&Java_org_lwjgl_opengl_EXTDrawRangeElements_nglDrawRangeElementsEXTVBO, NULL, NULL} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTDrawRangeElements"); - if (extgl_Extensions.GL_EXT_draw_range_elements) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_draw_range_elements", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTFogCoord.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTFogCoord.cpp index 49c5e204..e6be7ba7 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTFogCoord.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTFogCoord.cpp @@ -77,16 +77,15 @@ static void JNICALL Java_org_lwjgl_opengl_EXTFogCoord_nglFogCoordPointerEXTVBO } -void extgl_InitEXTFogCoord(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTFogCoord_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glFogCoordfEXT", "(F)V", (void*)&Java_org_lwjgl_opengl_EXTFogCoord_glFogCoordfEXT, "glFogCoordfEXT", (void**)&glFogCoordfEXT}, {"nglFogCoordPointerEXT", "(IILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_EXTFogCoord_nglFogCoordPointerEXT, "glFogCoordPointerEXT", (void**)&glFogCoordPointerEXT}, {"nglFogCoordPointerEXTVBO", "(III)V", (void*)&Java_org_lwjgl_opengl_EXTFogCoord_nglFogCoordPointerEXTVBO, NULL, NULL} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTFogCoord"); - if (extgl_Extensions.GL_EXT_fog_coord) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_fog_coord", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTMultiDrawArrays.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTMultiDrawArrays.cpp index 0c774cab..624fca19 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTMultiDrawArrays.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTMultiDrawArrays.cpp @@ -54,14 +54,13 @@ static void JNICALL Java_org_lwjgl_opengl_EXTMultiDrawArrays_nglMultiDrawArraysE } -void extgl_InitEXTMultiDrawArrays(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTMultiDrawArrays_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglMultiDrawArraysEXT", "(ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;II)V", (void*)&Java_org_lwjgl_opengl_EXTMultiDrawArrays_nglMultiDrawArraysEXT, "glMultiDrawArraysEXT", (void**)&glMultiDrawArraysEXT} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTMultiDrawArrays"); - if (extgl_Extensions.GL_EXT_multi_draw_arrays) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_multi_draw_arrays", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTPointParameters.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTPointParameters.cpp index 726ca0c5..f5a51869 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTPointParameters.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTPointParameters.cpp @@ -66,15 +66,14 @@ static void JNICALL Java_org_lwjgl_opengl_EXTPointParameters_nglPointParameterfv } -void extgl_InitEXTPointParameters(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTPointParameters_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glPointParameterfEXT", "(IF)V", (void*)&Java_org_lwjgl_opengl_EXTPointParameters_glPointParameterfEXT, "glPointParameterfEXT", (void**)&glPointParameterfEXT}, {"nglPointParameterfvEXT", "(ILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_EXTPointParameters_nglPointParameterfvEXT, "glPointParameterfvEXT", (void**)&glPointParameterfvEXT} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTPointParameters"); - if (extgl_Extensions.GL_EXT_point_parameters) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_point_parameters", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTSecondaryColor.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTSecondaryColor.cpp index e4b79000..0c287dea 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTSecondaryColor.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTSecondaryColor.cpp @@ -103,8 +103,8 @@ static void JNICALL Java_org_lwjgl_opengl_EXTSecondaryColor_nglSecondaryColorPoi } -void extgl_InitEXTSecondaryColor(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTSecondaryColor_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glSecondaryColor3bEXT", "(BBB)V", (void*)&Java_org_lwjgl_opengl_EXTSecondaryColor_glSecondaryColor3bEXT, "glSecondaryColor3bEXT", (void**)&glSecondaryColor3bEXT}, {"glSecondaryColor3fEXT", "(FFF)V", (void*)&Java_org_lwjgl_opengl_EXTSecondaryColor_glSecondaryColor3fEXT, "glSecondaryColor3fEXT", (void**)&glSecondaryColor3fEXT}, @@ -113,7 +113,7 @@ void extgl_InitEXTSecondaryColor(JNIEnv *env, jobject ext_set) {"nglSecondaryColorPointerEXTVBO", "(IIII)V", (void*)&Java_org_lwjgl_opengl_EXTSecondaryColor_nglSecondaryColorPointerEXTVBO, NULL, NULL} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTSecondaryColor"); - if (extgl_Extensions.GL_EXT_secondary_color) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_secondary_color", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTStencilTwoSide.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTStencilTwoSide.cpp index 09ffe0ed..cb2ce6b9 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTStencilTwoSide.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTStencilTwoSide.cpp @@ -52,13 +52,13 @@ static void JNICALL Java_org_lwjgl_opengl_EXTStencilTwoSide_glActiveStencilFaceE } -void extgl_InitEXTStencilTwoSide(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTStencilTwoSide_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glActiveStencilFaceEXT", "(I)V", (void*)&Java_org_lwjgl_opengl_EXTStencilTwoSide_glActiveStencilFaceEXT, "glActiveStencilFaceEXT", (void**)&glActiveStencilFaceEXT} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTStencilTwoSide"); - if (extgl_Extensions.GL_EXT_stencil_two_side) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_stencil_two_side", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTVertexShader.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTVertexShader.cpp index 5f0eaa13..65a2575d 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTVertexShader.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTVertexShader.cpp @@ -612,8 +612,8 @@ static void JNICALL Java_org_lwjgl_opengl_EXTVertexShader_nglGetLocalConstantFlo } -void extgl_InitEXTVertexShader(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTVertexShader_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glBeginVertexShaderEXT", "()V", (void*)&Java_org_lwjgl_opengl_EXTVertexShader_glBeginVertexShaderEXT, "glBeginVertexShaderEXT", (void**)&glBeginVertexShaderEXT}, {"glEndVertexShaderEXT", "()V", (void*)&Java_org_lwjgl_opengl_EXTVertexShader_glEndVertexShaderEXT, "glEndVertexShaderEXT", (void**)&glEndVertexShaderEXT}, @@ -659,7 +659,7 @@ void extgl_InitEXTVertexShader(JNIEnv *env, jobject ext_set) {"nglGetLocalConstantFloatvEXT", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_EXTVertexShader_nglGetLocalConstantFloatvEXT, "glGetLocalConstantFloatvEXT", (void**)&glGetLocalConstantFloatvEXT} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTVertexShader"); - if (extgl_Extensions.GL_EXT_vertex_shader) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_vertex_shader", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/ext/org_lwjgl_opengl_EXTVertexWeighting.cpp b/src/native/common/ext/org_lwjgl_opengl_EXTVertexWeighting.cpp index b83cfba4..52ab4dc7 100644 --- a/src/native/common/ext/org_lwjgl_opengl_EXTVertexWeighting.cpp +++ b/src/native/common/ext/org_lwjgl_opengl_EXTVertexWeighting.cpp @@ -77,15 +77,15 @@ static void JNICALL Java_org_lwjgl_opengl_EXTVertexWeighting_nglVertexWeightPoin } -void extgl_InitEXTVertexWeighting(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTVertexWeighting_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glVertexWeightfEXT", "(F)V", (void*)&Java_org_lwjgl_opengl_EXTVertexWeighting_glVertexWeightfEXT, "glVertexWeightfEXT", (void**)&glVertexWeightfEXT}, {"nglVertexWeightPointerEXT", "(IIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_EXTVertexWeighting_nglVertexWeightPointerEXT, "glVertexWeightPointerEXT", (void**)&glVertexWeightPointerEXT}, {"nglVertexWeightPointerEXTVBO", "(IIII)V", (void*)&Java_org_lwjgl_opengl_EXTVertexWeighting_nglVertexWeightPointerEXTVBO, NULL, NULL} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/EXTVertexWeighting"); - if (extgl_Extensions.GL_EXT_vertex_weighting) - extgl_InitializeClass(env, clazz, ext_set, "GL_EXT_vertex_weighting", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/extgl.cpp b/src/native/common/extgl.cpp index 1c0d1383..ab2e40b5 100755 --- a/src/native/common/extgl.cpp +++ b/src/native/common/extgl.cpp @@ -149,8 +149,8 @@ void *extgl_GetProcAddress(const char *name) #endif } -bool extgl_InitializeClass(JNIEnv *env, jclass clazz, jobject ext_set, const char *ext_name, int num_functions, JavaMethodAndExtFunction *functions) { - return ext_InitializeClass(env, clazz, ext_set, ext_name, &extgl_GetProcAddress, num_functions, functions); +bool extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) { + return ext_InitializeClass(env, clazz, NULL, NULL, &extgl_GetProcAddress, num_functions, functions); } bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions) { @@ -325,279 +325,6 @@ static bool GLQueryExtension(JNIEnv *env, jobject ext_set, const char *name) return extgl_QueryExtension(env, ext_set, glGetString(GL_EXTENSIONS), name); } -static void extgl_InitSupportedExtensions(JNIEnv *env, jobject ext_set) -{ - char *s = (char*) glGetString(GL_VERSION); - if (!s) - return; - s = strstr(s, "1."); - extgl_Extensions.OpenGL12 = false; - extgl_Extensions.OpenGL13 = false; - extgl_Extensions.OpenGL14 = false; - extgl_Extensions.OpenGL15 = false; - if (s != NULL) - { - // Fall trhough - switch (s[2]) { - case '5': - extgl_Extensions.OpenGL15 = true; - insertExtension(env, ext_set, "OpenGL15"); - case '4': - extgl_Extensions.OpenGL14 = true; - insertExtension(env, ext_set, "OpenGL14"); - case '3': - extgl_Extensions.OpenGL13 = true; - insertExtension(env, ext_set, "OpenGL13"); - case '2': - extgl_Extensions.OpenGL12 = true; - insertExtension(env, ext_set, "OpenGL12"); - break; - } - } - - 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"); - extgl_Extensions.GL_ARB_fragment_program_shadow = GLQueryExtension(env, ext_set, "GL_ARB_fragment_program_shadow"); - extgl_Extensions.GL_ARB_fragment_shader = GLQueryExtension(env, ext_set, "GL_ARB_fragment_shader"); - extgl_Extensions.GL_ARB_matrix_palette = GLQueryExtension(env, ext_set, "GL_ARB_matrix_palette"); - extgl_Extensions.GL_ARB_multisample = GLQueryExtension(env, ext_set, "GL_ARB_multisample"); - extgl_Extensions.GL_ARB_multitexture = GLQueryExtension(env, ext_set, "GL_ARB_multitexture"); - extgl_Extensions.GL_ARB_occlusion_query = GLQueryExtension(env, ext_set, "GL_ARB_occlusion_query"); - extgl_Extensions.GL_ARB_point_parameters = GLQueryExtension(env, ext_set, "GL_ARB_point_parameters"); - extgl_Extensions.GL_ARB_point_sprite = GLQueryExtension(env, ext_set, "GL_ARB_point_sprite"); - extgl_Extensions.GL_ARB_shading_language_100 = GLQueryExtension(env, ext_set, "GL_ARB_shading_language_100"); - extgl_Extensions.GL_ARB_shader_objects = GLQueryExtension(env, ext_set, "GL_ARB_shader_objects"); - extgl_Extensions.GL_ARB_shadow = GLQueryExtension(env, ext_set, "GL_ARB_shadow"); - extgl_Extensions.GL_ARB_shadow_ambient = GLQueryExtension(env, ext_set, "GL_ARB_shadow_ambient"); - extgl_Extensions.GL_ARB_texture_border_clamp = GLQueryExtension(env, ext_set, "GL_ARB_texture_border_clamp"); - extgl_Extensions.GL_ARB_texture_compression = GLQueryExtension(env, ext_set, "GL_ARB_texture_compression"); - extgl_Extensions.GL_ARB_texture_cube_map = GLQueryExtension(env, ext_set, "GL_ARB_texture_cube_map"); - extgl_Extensions.GL_ARB_texture_env_add = GLQueryExtension(env, ext_set, "GL_ARB_texture_env_add"); - extgl_Extensions.GL_ARB_texture_env_combine = GLQueryExtension(env, ext_set, "GL_ARB_texture_env_combine"); - extgl_Extensions.GL_ARB_texture_env_crossbar = GLQueryExtension(env, ext_set, "GL_ARB_texture_env_crossbar"); - extgl_Extensions.GL_ARB_texture_env_dot3 = GLQueryExtension(env, ext_set, "GL_ARB_texture_env_dot3"); - extgl_Extensions.GL_ARB_texture_mirrored_repeat = GLQueryExtension(env, ext_set, "GL_ARB_texture_mirrored_repeat"); - extgl_Extensions.GL_ARB_texture_non_power_of_two = GLQueryExtension(env, ext_set, "GL_ARB_texture_non_power_of_two"); - extgl_Extensions.GL_ARB_transpose_matrix = GLQueryExtension(env, ext_set, "GL_ARB_transpose_matrix"); - extgl_Extensions.GL_ARB_vertex_blend = GLQueryExtension(env, ext_set, "GL_ARB_vertex_blend"); - extgl_Extensions.GL_ARB_vertex_buffer_object = GLQueryExtension(env, ext_set, "GL_ARB_vertex_buffer_object"); - extgl_Extensions.GL_ARB_vertex_program = GLQueryExtension(env, ext_set, "GL_ARB_vertex_program"); - extgl_Extensions.GL_ARB_vertex_shader = GLQueryExtension(env, ext_set, "GL_ARB_vertex_shader"); - extgl_Extensions.GL_ARB_window_pos = GLQueryExtension(env, ext_set, "GL_ARB_window_pos"); - - extgl_Extensions.GL_EXT_abgr = GLQueryExtension(env, ext_set, "GL_EXT_abgr"); - extgl_Extensions.GL_EXT_bgra = GLQueryExtension(env, ext_set, "GL_EXT_bgra"); - extgl_Extensions.GL_EXT_blend_equation_separate = GLQueryExtension(env, ext_set, "GL_EXT_blend_equation_separate"); - 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"); - extgl_Extensions.GL_EXT_separate_specular_color = GLQueryExtension(env, ext_set, "GL_EXT_separate_specular_color"); - extgl_Extensions.GL_EXT_shadow_funcs = GLQueryExtension(env, ext_set, "GL_EXT_shadow_funcs"); - extgl_Extensions.GL_EXT_shared_texture_palette = GLQueryExtension(env, ext_set, "GL_EXT_shared_texture_palette"); - extgl_Extensions.GL_EXT_stencil_two_side = GLQueryExtension(env, ext_set, "GL_EXT_stencil_two_side"); - extgl_Extensions.GL_EXT_stencil_wrap = GLQueryExtension(env, ext_set, "GL_EXT_stencil_wrap"); - extgl_Extensions.GL_EXT_texture_compression_s3tc = GLQueryExtension(env, ext_set, "GL_EXT_texture_compression_s3tc"); - extgl_Extensions.GL_EXT_texture_env_combine = GLQueryExtension(env, ext_set, "GL_EXT_texture_env_combine"); - extgl_Extensions.GL_EXT_texture_env_dot3 = GLQueryExtension(env, ext_set, "GL_EXT_texture_env_dot3"); - extgl_Extensions.GL_EXT_texture_filter_anisotropic = GLQueryExtension(env, ext_set, "GL_EXT_texture_filter_anisotropic"); - extgl_Extensions.GL_EXT_texture_lod_bias = GLQueryExtension(env, ext_set, "GL_EXT_texture_lod_bias"); - extgl_Extensions.GL_EXT_texture_rectangle = GLQueryExtension(env, ext_set, "GL_EXT_texture_rectangle"); - extgl_Extensions.GL_EXT_vertex_shader = GLQueryExtension(env, ext_set, "GL_EXT_vertex_shader"); - extgl_Extensions.GL_EXT_vertex_weighting = GLQueryExtension(env, ext_set, "GL_EXT_vertex_weighting"); - - extgl_Extensions.GL_ATI_draw_buffers = GLQueryExtension(env, ext_set, "GL_ATI_draw_buffers"); - extgl_Extensions.GL_ATI_element_array = GLQueryExtension(env, ext_set, "GL_ATI_element_array"); - extgl_Extensions.GL_ATI_envmap_bumpmap = GLQueryExtension(env, ext_set, "GL_ATI_envmap_bumpmap"); - extgl_Extensions.GL_ATI_fragment_shader = GLQueryExtension(env, ext_set, "GL_ATI_fragment_shader"); - extgl_Extensions.GL_ATI_map_object_buffer = GLQueryExtension(env, ext_set, "GL_ATI_map_object_buffer"); - extgl_Extensions.GL_ATI_pn_triangles = GLQueryExtension(env, ext_set, "GL_ATI_pn_triangles"); - extgl_Extensions.GL_ATI_separate_stencil = GLQueryExtension(env, ext_set, "GL_ATI_separate_stencil"); - extgl_Extensions.GL_ATI_texture_float = GLQueryExtension(env, ext_set, "GL_ATI_texture_float"); - extgl_Extensions.GL_ATI_texture_mirror_once = GLQueryExtension(env, ext_set, "GL_ATI_texture_mirror_once"); - extgl_Extensions.GL_ATI_vertex_array_object = GLQueryExtension(env, ext_set, "GL_ATI_vertex_array_object"); - extgl_Extensions.GL_ATI_vertex_streams = GLQueryExtension(env, ext_set, "GL_ATI_vertex_streams"); - extgl_Extensions.GL_ATI_vertex_attrib_array_object = GLQueryExtension(env, ext_set, "GL_ATI_vertex_attrib_array_object"); - - extgl_Extensions.GL_NV_blend_square = GLQueryExtension(env, ext_set, "GL_NV_blend_square"); - extgl_Extensions.GL_NV_copy_depth_to_color = GLQueryExtension(env, ext_set, "GL_NV_copy_depth_to_color"); - extgl_Extensions.GL_NV_depth_clamp = GLQueryExtension(env, ext_set, "GL_NV_depth_clamp"); - extgl_Extensions.GL_NV_evaluators = GLQueryExtension(env, ext_set, "GL_NV_evaluators"); - extgl_Extensions.GL_NV_fence = GLQueryExtension(env, ext_set, "GL_NV_fence"); - 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"); - extgl_Extensions.GL_NV_occlusion_query = GLQueryExtension(env, ext_set, "GL_NV_occlusion_query"); - extgl_Extensions.GL_NV_packed_depth_stencil = GLQueryExtension(env, ext_set, "GL_NV_packed_depth_stencil"); - extgl_Extensions.GL_NV_pixel_data_range = GLQueryExtension(env, ext_set, "GL_NV_pixel_data_range"); - extgl_Extensions.GL_NV_point_sprite = GLQueryExtension(env, ext_set, "GL_NV_point_sprite"); - extgl_Extensions.GL_NV_primitive_restart = GLQueryExtension(env, ext_set, "GL_NV_primitive_restart"); - extgl_Extensions.GL_NV_register_combiners = GLQueryExtension(env, ext_set, "GL_NV_register_combiners"); - extgl_Extensions.GL_NV_register_combiners2 = GLQueryExtension(env, ext_set, "GL_NV_register_combiners2"); - extgl_Extensions.GL_NV_texgen_reflection = GLQueryExtension(env, ext_set, "GL_NV_texgen_reflection"); - extgl_Extensions.GL_NV_texture_compression_vtc = GLQueryExtension(env, ext_set, "GL_NV_texture_compression_vtc"); - extgl_Extensions.GL_NV_texture_env_combine4 = GLQueryExtension(env, ext_set, "GL_NV_texture_env_combine4"); - extgl_Extensions.GL_NV_texture_expand_normal = GLQueryExtension(env, ext_set, "GL_NV_texture_expand_normal"); - extgl_Extensions.GL_NV_texture_rectangle = GLQueryExtension(env, ext_set, "GL_NV_texture_rectangle"); - extgl_Extensions.GL_NV_texture_shader = GLQueryExtension(env, ext_set, "GL_NV_texture_shader"); - extgl_Extensions.GL_NV_texture_shader2 = GLQueryExtension(env, ext_set, "GL_NV_texture_shader2"); - extgl_Extensions.GL_NV_texture_shader3 = GLQueryExtension(env, ext_set, "GL_NV_texture_shader3"); - extgl_Extensions.GL_NV_vertex_array_range = GLQueryExtension(env, ext_set, "GL_NV_vertex_array_range"); - extgl_Extensions.GL_NV_vertex_array_range2 = GLQueryExtension(env, ext_set, "GL_NV_vertex_array_range2"); - 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_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); -extern void extgl_InitARBMultitexture(JNIEnv *env, jobject ext_set); -extern void extgl_InitARBOcclusionQuery(JNIEnv *env, jobject ext_set); -extern void extgl_InitARBPointParameters(JNIEnv *env, jobject ext_set); -extern void extgl_InitARBProgram(JNIEnv *env, jobject ext_set); -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_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_InitEXTBlendEquationSeparate(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); -extern void extgl_InitEXTPointParameters(JNIEnv *env, jobject ext_set); -extern void extgl_InitEXTSecondaryColor(JNIEnv *env, jobject ext_set); -extern void extgl_InitEXTStencilTwoSide(JNIEnv *env, jobject ext_set); -extern void extgl_InitEXTVertexShader(JNIEnv *env, jobject ext_set); -extern void extgl_InitEXTVertexWeighting(JNIEnv *env, jobject ext_set); - -extern void extgl_InitNVEvaluators(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVFragmentProgram(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVFence(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVHalfFloat(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVOcclusionQuery(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVPixelDataRange(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVPointSprite(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVPrimitiveRestart(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVProgram(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVRegisterCombiners(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVRegisterCombiners2(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVVertexArrayRange(JNIEnv *env, jobject ext_set); -extern void extgl_InitNVVertexProgram(JNIEnv *env, jobject ext_set); - -extern void extgl_InitATIDrawBuffers(JNIEnv *env, jobject ext_set); -extern void extgl_InitATIElementArray(JNIEnv *env, jobject ext_set); -extern void extgl_InitATIEnvmapBumpmap(JNIEnv *env, jobject ext_set); -extern void extgl_InitATIFragmentShader(JNIEnv *env, jobject ext_set); -extern void extgl_InitATIMapObjectBuffer(JNIEnv *env, jobject ext_set); -extern void extgl_InitATIPNTriangles(JNIEnv *env, jobject ext_set); -extern void extgl_InitATISeparateStencil(JNIEnv *env, jobject ext_set); -extern void extgl_InitATIVertexArrayObject(JNIEnv *env, jobject ext_set); -extern void extgl_InitATIVertexAttribArrayObject(JNIEnv *env, jobject ext_set); -extern void extgl_InitATIVertexStreams(JNIEnv *env, jobject ext_set); - -extern void extgl_InitOpenGL1_2(JNIEnv *env, jobject ext_set); -extern void extgl_InitOpenGL1_3(JNIEnv *env, jobject ext_set); -extern void extgl_InitOpenGL1_4(JNIEnv *env, jobject ext_set); -extern void extgl_InitOpenGL1_5(JNIEnv *env, jobject ext_set); - -/* extgl_Init the extensions and load all the functions */ -bool extgl_Initialize(JNIEnv *env, jobject ext_set) -{ - bool result = extgl_InitOpenGL1_1(env); - if (!result) - return false; - - extgl_InitSupportedExtensions(env, ext_set); - - //extgl_InitEXTNurbsTesselator(env, ext_set); - /* first load the extensions */ - extgl_InitARBBufferObject(env, ext_set); - extgl_InitARBImaging(env, ext_set); - extgl_InitARBMatrixPalette(env, ext_set); - extgl_InitARBMultisample(env, ext_set); - extgl_InitARBMultitexture(env, ext_set); - extgl_InitARBOcclusionQuery(env, ext_set); - extgl_InitARBPointParameters(env, ext_set); - extgl_InitARBProgram(env, ext_set); - extgl_InitARBShaderObjects(env, ext_set); - extgl_InitARBTextureCompression(env, ext_set); - extgl_InitARBTransposeMatrix(env, ext_set); - extgl_InitARBVertexBlend(env, ext_set); - extgl_InitARBVertexProgram(env, ext_set); - extgl_InitARBVertexShader(env, ext_set); - extgl_InitARBWindowPos(env, ext_set); - - extgl_InitEXTBlendEquationSeparate(env, ext_set); - extgl_InitEXTBlendFuncSeparate(env, ext_set); - extgl_InitEXTCompiledVertexArray(env, ext_set); - extgl_InitEXTDepthBoundsTest(env, ext_set); - extgl_InitEXTDrawRangeElements(env, ext_set); - extgl_InitEXTFogCoord(env, ext_set); - extgl_InitEXTMultiDrawArrays(env, ext_set); - extgl_InitEXTPointParameters(env, ext_set); - extgl_InitEXTSecondaryColor(env, ext_set); - extgl_InitEXTStencilTwoSide(env, ext_set); - extgl_InitEXTVertexShader(env, ext_set); - extgl_InitEXTVertexWeighting(env, ext_set); - - extgl_InitNVEvaluators(env, ext_set); - extgl_InitNVFence(env, ext_set); - extgl_InitNVFragmentProgram(env, ext_set); - extgl_InitNVHalfFloat(env, ext_set); - extgl_InitNVOcclusionQuery(env, ext_set); - extgl_InitNVPixelDataRange(env, ext_set); - extgl_InitNVPointSprite(env, ext_set); - extgl_InitNVPrimitiveRestart(env, ext_set); - extgl_InitNVProgram(env, ext_set); - extgl_InitNVRegisterCombiners(env, ext_set); - extgl_InitNVRegisterCombiners2(env, ext_set); - extgl_InitNVVertexArrayRange(env, ext_set); - extgl_InitNVVertexProgram(env, ext_set); - extgl_InitATIDrawBuffers(env, ext_set); - extgl_InitATIElementArray(env, ext_set); - extgl_InitATIEnvmapBumpmap(env, ext_set); - extgl_InitATIFragmentShader(env, ext_set); - extgl_InitATIMapObjectBuffer(env, ext_set); - extgl_InitATIPNTriangles(env, ext_set); - extgl_InitATISeparateStencil(env, ext_set); - extgl_InitATIVertexArrayObject(env, ext_set); - extgl_InitATIVertexAttribArrayObject(env, ext_set); - extgl_InitATIVertexStreams(env, ext_set); - - /* now load core opengl */ - extgl_InitOpenGL1_2(env, ext_set); - extgl_InitOpenGL1_3(env, ext_set); - extgl_InitOpenGL1_4(env, ext_set); - extgl_InitOpenGL1_5(env, ext_set); - - return true; -} - #ifdef _AGL bool extgl_Open(void) { if (opengl_bundle_ref != NULL) diff --git a/src/native/common/extgl.h b/src/native/common/extgl.h index a4b2bc2c..6239e247 100644 --- a/src/native/common/extgl.h +++ b/src/native/common/extgl.h @@ -422,119 +422,6 @@ struct ExtensionTypes bool GLX_SGI_swap_control; bool GLX_ARB_multisample; #endif /* X11 */ - - bool OpenGL12; - bool OpenGL13; - bool OpenGL14; - bool OpenGL15; - - bool GL_ARB_imaging; - bool GL_ARB_depth_texture; - bool GL_ARB_fragment_program; - bool GL_ARB_fragment_program_shadow; - bool GL_ARB_fragment_shader; - bool GL_ARB_matrix_palette; - bool GL_ARB_multisample; - bool GL_ARB_multitexture; - bool GL_ARB_occlusion_query; - bool GL_ARB_point_parameters; - bool GL_ARB_point_sprite; - bool GL_ARB_shading_language_100; - bool GL_ARB_shader_objects; - bool GL_ARB_shadow; - bool GL_ARB_shadow_ambient; - bool GL_ARB_texture_border_clamp; - bool GL_ARB_texture_compression; - bool GL_ARB_texture_cube_map; - bool GL_ARB_texture_env_add; - bool GL_ARB_texture_env_combine; - bool GL_ARB_texture_env_crossbar; - bool GL_ARB_texture_env_dot3; - bool GL_ARB_texture_mirrored_repeat; - bool GL_ARB_texture_non_power_of_two; - bool GL_ARB_transpose_matrix; - bool GL_ARB_vertex_blend; - bool GL_ARB_vertex_buffer_object; - bool GL_ARB_vertex_program; - bool GL_ARB_vertex_shader; - bool GL_ARB_window_pos; - - bool GL_EXT_abgr; - bool GL_EXT_bgra; - bool GL_EXT_blend_equation_separate; - 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; - bool GL_EXT_separate_specular_color; - bool GL_EXT_shadow_funcs; - bool GL_EXT_shared_texture_palette; - bool GL_EXT_stencil_two_side; - bool GL_EXT_stencil_wrap; - bool GL_EXT_texture_compression_s3tc; - bool GL_EXT_texture_env_combine; - bool GL_EXT_texture_env_dot3; - bool GL_EXT_texture_filter_anisotropic; - bool GL_EXT_texture_lod_bias; - bool GL_EXT_texture_rectangle; - bool GL_EXT_vertex_shader; - bool GL_EXT_vertex_weighting; - - bool GL_ATI_draw_buffers; - bool GL_ATI_element_array; - bool GL_ATI_envmap_bumpmap; - bool GL_ATI_fragment_shader; - bool GL_ATI_map_object_buffer; - bool GL_ATI_pn_triangles; - bool GL_ATI_separate_stencil; - bool GL_ATI_texture_float; - bool GL_ATI_texture_mirror_once; - bool GL_ATI_vertex_array_object; - bool GL_ATI_vertex_streams; - bool GL_ATI_vertex_attrib_array_object; - - bool GL_NV_blend_square; - bool GL_NV_copy_depth_to_color; - bool GL_NV_depth_clamp; - bool GL_NV_evaluators; - bool GL_NV_fence; - 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; - bool GL_NV_occlusion_query; - bool GL_NV_packed_depth_stencil; - bool GL_NV_pixel_data_range; - bool GL_NV_point_sprite; - bool GL_NV_primitive_restart; - bool GL_NV_register_combiners; - bool GL_NV_register_combiners2; - bool GL_NV_texgen_reflection; - bool GL_NV_texture_compression_vtc; - bool GL_NV_texture_env_combine4; - bool GL_NV_texture_expand_normal; - bool GL_NV_texture_rectangle; - bool GL_NV_texture_shader; - bool GL_NV_texture_shader2; - bool GL_NV_texture_shader3; - bool GL_NV_vertex_array_range; - bool GL_NV_vertex_array_range2; - 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; @@ -546,13 +433,12 @@ extern glGetErrorPROC glGetError; extern glGetStringPROC glGetString; /* initializes everything, call this right after the rc is created. the function returns 0 if successful */ -extern bool extgl_Initialize(JNIEnv *env, jobject gl_extensions); extern bool extgl_Open(void); #ifdef _AGL extern bool extgl_InitAGL(JNIEnv *env); #endif extern void extgl_Close(void); -extern bool extgl_InitializeClass(JNIEnv *env, jclass clazz, jobject ext_set, const char *ext_name, int num_functions, JavaMethodAndExtFunction *functions); +extern bool extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions); extern bool extgl_QueryExtension(JNIEnv *env, jobject ext_set, const GLubyte*extensions, const char *name); diff --git a/src/native/common/nv/org_lwjgl_opengl_NVEvaluators.cpp b/src/native/common/nv/org_lwjgl_opengl_NVEvaluators.cpp index d88916fa..8b3bedf0 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVEvaluators.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVEvaluators.cpp @@ -164,8 +164,8 @@ static void JNICALL Java_org_lwjgl_opengl_NVEvaluators_glEvalMapsNV } -void extgl_InitNVEvaluators(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVEvaluators_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglGetMapControlPointsNV", "(IIIIIZLjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_NVEvaluators_nglGetMapControlPointsNV, "glGetMapControlPointsNV", (void**)&glGetMapControlPointsNV}, {"nglMapControlPointsNV", "(IIIIIIIZLjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_NVEvaluators_nglMapControlPointsNV, "glMapControlPointsNV", (void**)&glMapControlPointsNV}, @@ -178,7 +178,6 @@ void extgl_InitNVEvaluators(JNIEnv *env, jobject ext_set) {"glEvalMapsNV", "(II)V", (void*)&Java_org_lwjgl_opengl_NVEvaluators_glEvalMapsNV, "glEvalMapsNV", (void**)&glEvalMapsNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVEvaluators"); - if (extgl_Extensions.GL_NV_evaluators) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_evaluators", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/nv/org_lwjgl_opengl_NVFence.cpp b/src/native/common/nv/org_lwjgl_opengl_NVFence.cpp index 618bbfe5..7361e140 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVFence.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVFence.cpp @@ -135,8 +135,8 @@ static void JNICALL Java_org_lwjgl_opengl_NVFence_nglGetFenceivNV } -void extgl_InitNVFence(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVFence_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglGenFencesNV", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVFence_nglGenFencesNV, "glGenFencesNV", (void**)&glGenFencesNV}, {"nglDeleteFencesNV", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVFence_nglDeleteFencesNV, "glDeleteFencesNV", (void**)&glDeleteFencesNV}, @@ -147,7 +147,6 @@ void extgl_InitNVFence(JNIEnv *env, jobject ext_set) {"nglGetFenceivNV", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVFence_nglGetFenceivNV, "glGetFenceivNV", (void**)&glGetFenceivNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVFence"); - if (extgl_Extensions.GL_NV_fence) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_fence", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/nv/org_lwjgl_opengl_NVFragmentProgram.cpp b/src/native/common/nv/org_lwjgl_opengl_NVFragmentProgram.cpp index 043f1bf0..a0dd2b52 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVFragmentProgram.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVFragmentProgram.cpp @@ -65,14 +65,13 @@ static void JNICALL Java_org_lwjgl_opengl_NVFragmentProgram_nglGetProgramNamedPa glGetProgramNamedParameterfvNV(id, length, name_ptr, params_ptr); } -void extgl_InitNVFragmentProgram(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVFragmentProgram_initNativeStubs(JNIEnv *env, jclass clazz) { 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}, }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVFragmentProgram"); - if (extgl_Extensions.GL_NV_fragment_program) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_fragment_program", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/nv/org_lwjgl_opengl_NVHalfFloat.cpp b/src/native/common/nv/org_lwjgl_opengl_NVHalfFloat.cpp index 586d3f51..cd7fb609 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVHalfFloat.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVHalfFloat.cpp @@ -357,8 +357,8 @@ static void JNICALL Java_org_lwjgl_opengl_NVHalfFloat_nglVertexAttribs4hvNV } -void extgl_InitNVHalfFloat(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVHalfFloat_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glVertex2hNV", "(SS)V", (void*)&Java_org_lwjgl_opengl_NVHalfFloat_glVertex2hNV, "glVertex2hNV", (void**)&glVertex2hNV}, {"glVertex3hNV", "(SSS)V", (void*)&Java_org_lwjgl_opengl_NVHalfFloat_glVertex3hNV, "glVertex3hNV", (void**)&glVertex3hNV}, @@ -386,7 +386,7 @@ void extgl_InitNVHalfFloat(JNIEnv *env, jobject ext_set) {"nglVertexAttribs4hvNV", "(IILjava/nio/ShortBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVHalfFloat_nglVertexAttribs4hvNV, "glVertexAttribs4hvNV", (void**)&glVertexAttribs4hvNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVHalfFloat"); - if (extgl_Extensions.GL_NV_half_float) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_half_float", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/nv/org_lwjgl_opengl_NVOcclusionQuery.cpp b/src/native/common/nv/org_lwjgl_opengl_NVOcclusionQuery.cpp index 040592ce..eb24f08d 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVOcclusionQuery.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVOcclusionQuery.cpp @@ -135,8 +135,8 @@ static void JNICALL Java_org_lwjgl_opengl_NVOcclusionQuery_nglGetOcclusionQueryu } -void extgl_InitNVOcclusionQuery(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVOcclusionQuery_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglGenOcclusionQueriesNV", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVOcclusionQuery_nglGenOcclusionQueriesNV, "glGenOcclusionQueriesNV", (void**)&glGenOcclusionQueriesNV}, {"nglDeleteOcclusionQueriesNV", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVOcclusionQuery_nglDeleteOcclusionQueriesNV, "glDeleteOcclusionQueriesNV", (void**)&glDeleteOcclusionQueriesNV}, @@ -147,7 +147,7 @@ void extgl_InitNVOcclusionQuery(JNIEnv *env, jobject ext_set) {"nglGetOcclusionQueryuivNV", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVOcclusionQuery_nglGetOcclusionQueryuivNV, "glGetOcclusionQueryuivNV", (void**)&glGetOcclusionQueryuivNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVOcclusionQuery"); - if (extgl_Extensions.GL_NV_occlusion_query) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_occlusion_query", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/nv/org_lwjgl_opengl_NVPixelDataRange.cpp b/src/native/common/nv/org_lwjgl_opengl_NVPixelDataRange.cpp index 56f8484d..2f322678 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVPixelDataRange.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVPixelDataRange.cpp @@ -66,14 +66,14 @@ static void JNICALL Java_org_lwjgl_opengl_NVPixelDataRange_glFlushPixelDataRange } -void extgl_InitNVPixelDataRange(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVPixelDataRange_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglPixelDataRangeNV", "(IILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_NVPixelDataRange_nglPixelDataRangeNV, "glPixelDataRangeNV", (void**)&glPixelDataRangeNV}, {"glFlushPixelDataRangeNV", "(I)V", (void*)&Java_org_lwjgl_opengl_NVPixelDataRange_glFlushPixelDataRangeNV, "glFlushPixelDataRangeNV", (void**)&glFlushPixelDataRangeNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVPixelDataRange"); - if (extgl_Extensions.GL_NV_pixel_data_range) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_pixel_data_range", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/nv/org_lwjgl_opengl_NVPointSprite.cpp b/src/native/common/nv/org_lwjgl_opengl_NVPointSprite.cpp index 9cdb18f9..0e7dfcbc 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVPointSprite.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVPointSprite.cpp @@ -66,14 +66,14 @@ static void JNICALL Java_org_lwjgl_opengl_NVPointSprite_nglPointParameterivNV } -void extgl_InitNVPointSprite(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVPointSprite_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glPointParameteriNV", "(II)V", (void*)&Java_org_lwjgl_opengl_NVPointSprite_glPointParameteriNV, "glPointParameteriNV", (void**)&glPointParameteriNV}, {"nglPointParameterivNV", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVPointSprite_nglPointParameterivNV, "glPointParameterivNV", (void**)&glPointParameterivNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVPointSprite"); - if (extgl_Extensions.GL_NV_point_sprite) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_point_sprite", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/nv/org_lwjgl_opengl_NVPrimitiveRestart.cpp b/src/native/common/nv/org_lwjgl_opengl_NVPrimitiveRestart.cpp index 38622a61..a135dbea 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVPrimitiveRestart.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVPrimitiveRestart.cpp @@ -65,14 +65,14 @@ static void JNICALL Java_org_lwjgl_opengl_NVPrimitiveRestart_glPrimitiveRestartI } -void extgl_InitNVPrimitiveRestart(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVPrimitiveRestart_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glPrimitiveRestartNV", "()V", (void*)&Java_org_lwjgl_opengl_NVPrimitiveRestart_glPrimitiveRestartNV, "glPrimitiveRestartNV", (void**)&glPrimitiveRestartNV}, {"glPrimitiveRestartIndexNV", "(I)V", (void*)&Java_org_lwjgl_opengl_NVPrimitiveRestart_glPrimitiveRestartIndexNV, "glPrimitiveRestartIndexNV", (void**)&glPrimitiveRestartIndexNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVPrimitiveRestart"); - if (extgl_Extensions.GL_NV_primitive_restart) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_primitive_restart", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/nv/org_lwjgl_opengl_NVProgram.cpp b/src/native/common/nv/org_lwjgl_opengl_NVProgram.cpp index cd506564..41559a08 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVProgram.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVProgram.cpp @@ -166,8 +166,8 @@ static void JNICALL Java_org_lwjgl_opengl_NVProgram_nglRequestResidentProgramsNV } -void extgl_InitNVProgram(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVProgram_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglLoadProgramNV", "(IIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_NVProgram_nglLoadProgramNV, "glLoadProgramNV", (void**)&glLoadProgramNV}, {"glBindProgramNV", "(II)V", (void*)&Java_org_lwjgl_opengl_NVProgram_glBindProgramNV, "glBindProgramNV", (void**)&glBindProgramNV}, @@ -180,6 +180,7 @@ void extgl_InitNVProgram(JNIEnv *env, jobject ext_set) {"nglRequestResidentProgramsNV", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVProgram_nglRequestResidentProgramsNV, "glRequestResidentProgramsNV", (void**)&glRequestResidentProgramsNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVProgram"); - extgl_InitializeClass(env, clazz, NULL, NULL, num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/nv/org_lwjgl_opengl_NVRegisterCombiners.cpp b/src/native/common/nv/org_lwjgl_opengl_NVRegisterCombiners.cpp index a0094bee..f92f91ec 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVRegisterCombiners.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVRegisterCombiners.cpp @@ -216,8 +216,8 @@ static void JNICALL Java_org_lwjgl_opengl_NVRegisterCombiners_nglGetFinalCombine } -void extgl_InitNVRegisterCombiners(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVRegisterCombiners_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glCombinerParameterfNV", "(IF)V", (void*)&Java_org_lwjgl_opengl_NVRegisterCombiners_glCombinerParameterfNV, "glCombinerParameterfNV", (void**)&glCombinerParameterfNV}, {"nglCombinerParameterfvNV", "(ILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVRegisterCombiners_nglCombinerParameterfvNV, "glCombinerParameterfvNV", (void**)&glCombinerParameterfvNV}, @@ -234,7 +234,7 @@ void extgl_InitNVRegisterCombiners(JNIEnv *env, jobject ext_set) {"nglGetFinalCombinerInputParameterivNV", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVRegisterCombiners_nglGetFinalCombinerInputParameterivNV, "glGetFinalCombinerInputParameterivNV", (void**)&glGetFinalCombinerInputParameterivNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVRegisterCombiners"); - if (extgl_Extensions.GL_NV_register_combiners) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_register_combiners", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/nv/org_lwjgl_opengl_NVRegisterCombiners2.cpp b/src/native/common/nv/org_lwjgl_opengl_NVRegisterCombiners2.cpp index 69ff6901..f36367a6 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVRegisterCombiners2.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVRegisterCombiners2.cpp @@ -67,14 +67,14 @@ static void JNICALL Java_org_lwjgl_opengl_NVRegisterCombiners2_nglGetCombinerSta } -void extgl_InitNVRegisterCombiners2(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVRegisterCombiners2_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglCombinerStageParameterfvNV", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVRegisterCombiners2_nglCombinerStageParameterfvNV, "glCombinerStageParameterfvNV", (void**)&glCombinerStageParameterfvNV}, {"nglGetCombinerStageParameterfvNV", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVRegisterCombiners2_nglGetCombinerStageParameterfvNV, "glGetCombinerStageParameterfvNV", (void**)&glGetCombinerStageParameterfvNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVRegisterCombiners2"); - if (extgl_Extensions.GL_NV_register_combiners2) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_register_combiners2", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/nv/org_lwjgl_opengl_NVVertexArrayRange.cpp b/src/native/common/nv/org_lwjgl_opengl_NVVertexArrayRange.cpp index 2c13219b..6d80f57a 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVVertexArrayRange.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVVertexArrayRange.cpp @@ -118,8 +118,8 @@ static void JNICALL Java_org_lwjgl_opengl_NVVertexArrayRange_wglFreeMemoryNV } #endif -void extgl_InitNVVertexArrayRange(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexArrayRange_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglVertexArrayRangeNV", "(ILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_NVVertexArrayRange_nglVertexArrayRangeNV, "glVertexArrayRangeNV", (void**)&glVertexArrayRangeNV}, {"glFlushVertexArrayRangeNV", "()V", (void*)&Java_org_lwjgl_opengl_NVVertexArrayRange_glFlushVertexArrayRangeNV, "glFlushVertexArrayRangeNV", (void**)&glFlushVertexArrayRangeNV}, @@ -133,8 +133,7 @@ void extgl_InitNVVertexArrayRange(JNIEnv *env, jobject ext_set) #endif }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVVertexArrayRange"); - if (extgl_Extensions.GL_NV_vertex_array_range) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_vertex_array_range", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/nv/org_lwjgl_opengl_NVVertexProgram.cpp b/src/native/common/nv/org_lwjgl_opengl_NVVertexProgram.cpp index cfc53bce..9cfade70 100644 --- a/src/native/common/nv/org_lwjgl_opengl_NVVertexProgram.cpp +++ b/src/native/common/nv/org_lwjgl_opengl_NVVertexProgram.cpp @@ -396,8 +396,8 @@ static void JNICALL Java_org_lwjgl_opengl_NVVertexProgram_nglVertexAttribs4ubvNV } -void extgl_InitNVVertexProgram(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVVertexProgram_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglExecuteProgramNV", "(IILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVVertexProgram_nglExecuteProgramNV, "glExecuteProgramNV", (void**)&glExecuteProgramNV}, {"nglGetProgramParameterfvNV", "(IIILjava/nio/FloatBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVVertexProgram_nglGetProgramParameterfvNV, "glGetProgramParameterfvNV", (void**)&glGetProgramParameterfvNV}, @@ -430,7 +430,7 @@ void extgl_InitNVVertexProgram(JNIEnv *env, jobject ext_set) {"nglVertexAttribs4ubvNV", "(IILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_opengl_NVVertexProgram_nglVertexAttribs4ubvNV, "glVertexAttribs4ubvNV", (void**)&glVertexAttribs4ubvNV} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/NVVertexProgram"); - if (extgl_Extensions.GL_NV_vertex_program) - extgl_InitializeClass(env, clazz, ext_set, "GL_NV_vertex_program", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); } +} + diff --git a/src/native/common/org_lwjgl_opengl_GL11.cpp b/src/native/common/org_lwjgl_opengl_GL11.cpp index 93f62792..460f5a28 100644 --- a/src/native/common/org_lwjgl_opengl_GL11.cpp +++ b/src/native/common/org_lwjgl_opengl_GL11.cpp @@ -2571,8 +2571,8 @@ static void JNICALL Java_org_lwjgl_opengl_GL11_glViewport(JNIEnv * env, jclass c } -bool extgl_InitOpenGL1_1(JNIEnv *env) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL11_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glAccum", "(IF)V", (void*)&Java_org_lwjgl_opengl_GL11_glAccum, "glAccum", (void**)&glAccum}, {"glAlphaFunc", "(IF)V", (void*)&Java_org_lwjgl_opengl_GL11_glAlphaFunc, "glAlphaFunc", (void**)&glAlphaFunc}, @@ -2782,7 +2782,7 @@ bool extgl_InitOpenGL1_1(JNIEnv *env) {"glViewport", "(IIII)V", (void*)&Java_org_lwjgl_opengl_GL11_glViewport, "glViewport", (void**)&glViewport} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/GL11"); - return extgl_InitializeClass(env, clazz, NULL, "GL11", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/org_lwjgl_opengl_GL12.cpp b/src/native/common/org_lwjgl_opengl_GL12.cpp index 6b8ed40b..acc9fdc4 100644 --- a/src/native/common/org_lwjgl_opengl_GL12.cpp +++ b/src/native/common/org_lwjgl_opengl_GL12.cpp @@ -115,8 +115,8 @@ static void JNICALL Java_org_lwjgl_opengl_GL12_glCopyTexSubImage3D } -void extgl_InitOpenGL1_2(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL12_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglDrawRangeElements", "(IIIIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_opengl_GL12_nglDrawRangeElements, "glDrawRangeElements", (void**)&glDrawRangeElements}, {"nglDrawRangeElementsVBO", "(IIIIII)V", (void*)&Java_org_lwjgl_opengl_GL12_nglDrawRangeElementsVBO, NULL, NULL}, @@ -125,8 +125,6 @@ void extgl_InitOpenGL1_2(JNIEnv *env, jobject ext_set) {"glCopyTexSubImage3D", "(IIIIIIIII)V", (void*)&Java_org_lwjgl_opengl_GL12_glCopyTexSubImage3D, "glCopyTexSubImage3D", (void**)&glCopyTexSubImage3D} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/GL12"); - if (extgl_Extensions.OpenGL12) - extgl_InitializeClass(env, clazz, ext_set, "OpenGL12", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } - diff --git a/src/native/common/org_lwjgl_opengl_GL13.cpp b/src/native/common/org_lwjgl_opengl_GL13.cpp index 548176a0..026e5e94 100644 --- a/src/native/common/org_lwjgl_opengl_GL13.cpp +++ b/src/native/common/org_lwjgl_opengl_GL13.cpp @@ -285,8 +285,8 @@ static void JNICALL Java_org_lwjgl_opengl_GL13_glSampleCoverage } -void extgl_InitOpenGL1_3(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL13_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glActiveTexture", "(I)V", (void*)&Java_org_lwjgl_opengl_GL13_glActiveTexture, "glActiveTexture", (void**)&glActiveTexture}, {"glClientActiveTexture", "(I)V", (void*)&Java_org_lwjgl_opengl_GL13_glClientActiveTexture, "glClientActiveTexture", (void**)&glClientActiveTexture}, @@ -306,8 +306,7 @@ void extgl_InitOpenGL1_3(JNIEnv *env, jobject ext_set) {"glSampleCoverage", "(FZ)V", (void*)&Java_org_lwjgl_opengl_GL13_glSampleCoverage, "glSampleCoverage", (void**)&glSampleCoverage} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/GL13"); - if (extgl_Extensions.OpenGL13) - extgl_InitializeClass(env, clazz, ext_set, "OpenGL13", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/org_lwjgl_opengl_GL14.cpp b/src/native/common/org_lwjgl_opengl_GL14.cpp index 547796ab..8c4b34cd 100644 --- a/src/native/common/org_lwjgl_opengl_GL14.cpp +++ b/src/native/common/org_lwjgl_opengl_GL14.cpp @@ -269,8 +269,8 @@ static void JNICALL Java_org_lwjgl_opengl_GL14_glWindowPos3i glWindowPos3i(p1, p2, p3); } -void extgl_InitOpenGL1_4(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL14_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"glBlendEquation", "(I)V", (void*)&Java_org_lwjgl_opengl_GL14_glBlendEquation, "glBlendEquation", (void**)&glBlendEquation}, {"glBlendColor", "(FFFF)V", (void*)&Java_org_lwjgl_opengl_GL14_glBlendColor, "glBlendColor", (void**)&glBlendColor}, @@ -292,8 +292,7 @@ void extgl_InitOpenGL1_4(JNIEnv *env, jobject ext_set) {"glWindowPos3i", "(III)V", (void*)&Java_org_lwjgl_opengl_GL14_glWindowPos3i, "glWindowPos3i", (void**)&glWindowPos3i} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/GL14"); - if (extgl_Extensions.OpenGL14) - extgl_InitializeClass(env, clazz, ext_set, "OpenGL14", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/org_lwjgl_opengl_GL15.cpp b/src/native/common/org_lwjgl_opengl_GL15.cpp index 07c4e21f..538165b2 100644 --- a/src/native/common/org_lwjgl_opengl_GL15.cpp +++ b/src/native/common/org_lwjgl_opengl_GL15.cpp @@ -313,8 +313,8 @@ static void JNICALL Java_org_lwjgl_opengl_GL15_nglGetQueryObjectuiv } -void extgl_InitOpenGL1_5(JNIEnv *env, jobject ext_set) -{ +extern "C" { +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL15_initNativeStubs(JNIEnv *env, jclass clazz) { JavaMethodAndExtFunction functions[] = { {"nglBindBuffer", "(II)V", (void*)&Java_org_lwjgl_opengl_GL15_nglBindBuffer, "glBindBuffer", (void**)&glBindBuffer}, {"nglDeleteBuffers", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL15_nglDeleteBuffers, "glDeleteBuffers", (void**)&glDeleteBuffers}, @@ -337,8 +337,7 @@ void extgl_InitOpenGL1_5(JNIEnv *env, jobject ext_set) {"nglGetQueryObjectuiv", "(IILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_opengl_GL15_nglGetQueryObjectuiv, "glGetQueryObjectuiv", (void**)&glGetQueryObjectuiv} }; int num_functions = NUMFUNCTIONS(functions); - jclass clazz = ext_ResetClass(env, "org/lwjgl/opengl/GL15"); - if (extgl_Extensions.OpenGL15) - extgl_InitializeClass(env, clazz, ext_set, "OpenGL15", num_functions, functions); + extgl_InitializeClass(env, clazz, num_functions, functions); +} } diff --git a/src/native/common/org_lwjgl_opengl_GLContext.cpp b/src/native/common/org_lwjgl_opengl_GLContext.cpp index 489086ee..db462297 100644 --- a/src/native/common/org_lwjgl_opengl_GLContext.cpp +++ b/src/native/common/org_lwjgl_opengl_GLContext.cpp @@ -34,20 +34,13 @@ #include "extgl.h" #include "common_tools.h" -/* - * Class: org_lwjgl_opengl_GLContext - * Method: init - * Signature: (Ljava/util/Set;)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_init - (JNIEnv * env, jclass clazz, jobject exts) -{ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_loadOpenGLLibrary(JNIEnv * env, jclass clazz) { if (!extgl_Open()) { throwException(env, "Failed to load OpenGL library"); return; } - if (!extgl_Initialize(env, exts)) { - throwException(env, "Failed to initialize GL extensions"); - return; - } +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_resetNativeStubs(JNIEnv *env, jclass clazz, jclass gl_class) { + env->UnregisterNatives(gl_class); } diff --git a/src/native/common/org_lwjgl_opengl_GLContext.h b/src/native/common/org_lwjgl_opengl_GLContext.h index 9e9804e3..58bec9ab 100644 --- a/src/native/common/org_lwjgl_opengl_GLContext.h +++ b/src/native/common/org_lwjgl_opengl_GLContext.h @@ -120,14 +120,24 @@ extern "C" { /* Inaccessible static: OpenGL13 */ /* Inaccessible static: OpenGL14 */ /* Inaccessible static: OpenGL15 */ +/* Inaccessible static: extension_classes */ +/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024GL12 */ /* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024GLContext */ /* * Class: org_lwjgl_opengl_GLContext - * Method: init - * Signature: (Ljava/util/Set;)V + * Method: loadOpenGLLibrary + * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_init - (JNIEnv *, jclass, jobject); +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_loadOpenGLLibrary + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_opengl_GLContext + * Method: resetNativeStubs + * Signature: (Ljava/lang/Class;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_resetNativeStubs + (JNIEnv *, jclass, jclass); #ifdef __cplusplus } diff --git a/src/native/linux/Window.h b/src/native/linux/Window.h index bfd53723..b0a587e1 100644 --- a/src/native/linux/Window.h +++ b/src/native/linux/Window.h @@ -121,11 +121,6 @@ */ extern int convertToBPE(int bpp); - /* - * Make the window context current - */ - void makeCurrent(void); - /* * Return the current OpenGL window context */ diff --git a/src/native/linux/org_lwjgl_opengl_Display.cpp b/src/native/linux/org_lwjgl_opengl_Display.cpp index 285f4073..989a8194 100644 --- a/src/native/linux/org_lwjgl_opengl_Display.cpp +++ b/src/native/linux/org_lwjgl_opengl_Display.cpp @@ -352,22 +352,18 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nUpdate handleMessages(); } -/* - * Class: org_lwjgl_Window - * Method: nMakeCurrent - * Signature: ()V - */ +static bool makeCurrent(void) { + if (USEGLX13) + return glXMakeContextCurrent(getDisplay(), glx_window, glx_window, context) == True; + else + return glXMakeCurrent(getDisplay(), getCurrentWindow(), context) == True; +} + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nMakeCurrent (JNIEnv *env, jclass clazz) { - makeCurrent(); -} - -void makeCurrent(void) { - if (USEGLX13) - glXMakeContextCurrent(getDisplay(), glx_window, glx_window, context); - else - glXMakeCurrent(getDisplay(), getCurrentWindow(), context); + if (!makeCurrent()) + throwException(env, "Could not make display context current"); } static void releaseContext(void) { @@ -668,8 +664,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_nCreateWindow(JNIEnv *env, dumpVisualInfo(vis_info); if (USEGLX13) glx_window = glXCreateWindow(getDisplay(), configs[0], getCurrentWindow(), NULL); - makeCurrent(); - if (!checkXError(env)) { + if (!makeCurrent() || !checkXError(env)) { glXDestroyWindow(getDisplay(), glx_window); destroyWindow(); } diff --git a/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp b/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp index 3a778f50..b467aaac 100644 --- a/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp +++ b/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp @@ -154,7 +154,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nMakeCurrent GLXPbuffer buffer = buffer_info->buffer; GLXContext context = buffer_info->context; if (glXMakeContextCurrent(getDisplay(), buffer, buffer, context) == False) { - printfDebug("Could not make pbuffer current"); + throwException(env, "Could not make pbuffer context current"); } }