diff --git a/platform_build/win32_vs_net/lwjgl.suo b/platform_build/win32_vs_net/lwjgl.suo index 3ed17324..e9298d80 100644 Binary files a/platform_build/win32_vs_net/lwjgl.suo and b/platform_build/win32_vs_net/lwjgl.suo differ diff --git a/platform_build/win32_vs_net/lwjgl.vcproj b/platform_build/win32_vs_net/lwjgl.vcproj index f0b76382..9b776108 100644 --- a/platform_build/win32_vs_net/lwjgl.vcproj +++ b/platform_build/win32_vs_net/lwjgl.vcproj @@ -177,7 +177,7 @@ RelativePath="..\..\src\native\common\org_lwjgl_opengl_GL14.cpp"> + RelativePath="..\..\src\native\common\org_lwjgl_opengl_GL15.cpp"> + + @@ -218,157 +221,160 @@ Name="arb" Filter=""> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBImaging.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBMatrixPalette.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBMultisample.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBMultitexture.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBOcclusionQuery.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBPointParameters.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBProgram.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBShaderObjects.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBTextureCompression.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBTransposeMatrix.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBVertexBlend.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBVertexBufferObject.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBVertexProgram.cpp"> + RelativePath="..\..\src\native\common\arb\org_lwjgl_opengl_ARBVertexShader.cpp"> + + + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIDrawBuffers.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIElementArray.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIEnvmapBumpmap.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIFragmentShader.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIMapObjectBuffer.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIPnTriangles.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATISeparateStencil.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIVertexArrayObject.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIVertexAttribArrayObject.cpp"> + RelativePath="..\..\src\native\common\ati\org_lwjgl_opengl_ATIVertexStreams.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTBlendFuncSeparate.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTCompiledVertexArray.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTDrawRangeElements.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTFogCoord.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTMultiDrawArrays.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTPointParameters.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTSecondaryColor.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTStencilTwoSide.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTVertexShader.cpp"> + RelativePath="..\..\src\native\common\ext\org_lwjgl_opengl_EXTVertexWeighting.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVEvaluators.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVFence.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVFragmentProgram.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVHalfFloat.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVOcclusionQuery.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVPixelDataRange.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVPointSprite.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVPrimitiveRestart.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVProgram.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVRegisterCombiners.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVRegisterCombiners2.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVVertexArrayRange.cpp"> + RelativePath="..\..\src\native\common\nv\org_lwjgl_opengl_NVVertexProgram.cpp"> diff --git a/src/java/org/lwjgl/Sys.java b/src/java/org/lwjgl/Sys.java index ab2aa5b5..60f5f532 100644 --- a/src/java/org/lwjgl/Sys.java +++ b/src/java/org/lwjgl/Sys.java @@ -204,7 +204,7 @@ public final class Sys { */ public static void alert(String title, String message) { String osName = System.getProperty("os.name"); - if (osName.startsWith("Windoxws")) { + if (osName.startsWith("Windows")) { nAlert(title, message); } else { try { diff --git a/src/java/org/lwjgl/opengl/GLContext.java b/src/java/org/lwjgl/opengl/GLContext.java index 99fc43b2..05aedd2d 100644 --- a/src/java/org/lwjgl/opengl/GLContext.java +++ b/src/java/org/lwjgl/opengl/GLContext.java @@ -35,9 +35,7 @@ package org.lwjgl.opengl; import java.lang.ref.WeakReference; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.HashMap; import java.util.HashSet; -import java.util.Map; import java.util.Set; import org.lwjgl.Sys; @@ -56,13 +54,7 @@ public final class GLContext { /** The currently initialised context */ private static WeakReference currentContext; - - /** A map of WeakReferences to contexts to LWJGL pointers-to-extension-structs */ - private static final Map contextMap = new HashMap(); - - /** A map of WeakReferences to contents to Sets of extension names */ - private static final Map extensionsMap = new HashMap(); - + /* * Available extensions */ @@ -212,7 +204,10 @@ public final class GLContext { * in the future, freeing up a little RAM. * @param context The context object, which uniquely identifies a GL context */ - public static synchronized void setContext(Object context) { + public static synchronized void useContext(Object context) { + if (context == null) { + throw new NullPointerException("Can't use a null context"); + } // Is this the same as last time? Object current = currentContext == null ? null : currentContext.get(); if (current == context) { @@ -222,35 +217,16 @@ public final class GLContext { // Ok, now it's the current context. currentContext = new WeakReference(context); - - // Look in the context map to see if we've encountered this context before - Integer encountered = (Integer) contextMap.get(currentContext); - Set exts; - if (encountered != null) { - exts = (Set) extensionsMap.get(currentContext); - reinit(encountered.intValue()); - } else { - exts = new HashSet(); - contextMap.put(currentContext, new Integer(init(exts))); - } - + HashSet exts = new HashSet(); + init(exts); determineAvailableExtensions(exts); - VBOTracker.setCurrent(currentContext); } /** - * Native method to initialize a context from scratch or load its function pointers from a - * cache. + * Native method to initialize a context * @param exts An empty Set of Strings that will be filled with the names of enabled extensions - * @return a LWJGL context-index-pointer */ - private static native int init(Set exts); - - /** - * Native method to re-initialize a context. - * @param context Hash code of the context object - */ - private static native void reinit(int context); + private static native void init(Set exts); } diff --git a/src/java/org/lwjgl/opengl/Window.java b/src/java/org/lwjgl/opengl/Window.java index 21886231..15af28dd 100644 --- a/src/java/org/lwjgl/opengl/Window.java +++ b/src/java/org/lwjgl/opengl/Window.java @@ -225,7 +225,7 @@ public final class Window { public static synchronized void makeCurrent() { assert isCreated() : "No window has been created."; nMakeCurrent(); - GLContext.setContext(context); + GLContext.useContext(context); } /** diff --git a/src/java/org/lwjgl/test/opengl/Game.java b/src/java/org/lwjgl/test/opengl/Game.java index 06416862..aa07c053 100644 --- a/src/java/org/lwjgl/test/opengl/Game.java +++ b/src/java/org/lwjgl/test/opengl/Game.java @@ -185,7 +185,7 @@ public final class Game { GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight()); - ByteBuffer num_tex_units_buf = ByteBuffer.allocateDirect(4); + ByteBuffer num_tex_units_buf = ByteBuffer.allocateDirect(64); num_tex_units_buf.order(ByteOrder.nativeOrder()); GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS, num_tex_units_buf.asIntBuffer()); System.out.println("Number of texture units: " + num_tex_units_buf.getInt()); diff --git a/src/java/org/lwjgl/test/opengl/Grass.java b/src/java/org/lwjgl/test/opengl/Grass.java index 8f9dd5ca..e4fde497 100644 --- a/src/java/org/lwjgl/test/opengl/Grass.java +++ b/src/java/org/lwjgl/test/opengl/Grass.java @@ -81,7 +81,7 @@ public class Grass { mode = i; break; } - } + } if (mode == -1) { System.out.println("did not find suitable mode"); diff --git a/src/native/common/org_lwjgl_opengl_GLContext.cpp b/src/native/common/org_lwjgl_opengl_GLContext.cpp index e671b074..0376b0dd 100644 --- a/src/native/common/org_lwjgl_opengl_GLContext.cpp +++ b/src/native/common/org_lwjgl_opengl_GLContext.cpp @@ -37,25 +37,12 @@ /* * Class: org_lwjgl_opengl_GLContext * Method: init - * Signature: (Ljava/util/Set;)I + * Signature: (Ljava/util/Set;)V */ -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_GLContext_init +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_init (JNIEnv * env, jclass clazz, jobject exts) { if (!extgl_Initialize(env, exts)) { throwException(env, "Failed to initialize GL extensions"); - return -1; } - - return 0; } - -/* - * Class: org_lwjgl_opengl_GLContext - * Method: reinit - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_reinit - (JNIEnv * env, jclass clazz, jint context) -{ -} \ No newline at end of file diff --git a/src/native/common/org_lwjgl_opengl_GLContext.h b/src/native/common/org_lwjgl_opengl_GLContext.h index e643ade9..e125ab47 100644 --- a/src/native/common/org_lwjgl_opengl_GLContext.h +++ b/src/native/common/org_lwjgl_opengl_GLContext.h @@ -119,19 +119,11 @@ extern "C" { /* * Class: org_lwjgl_opengl_GLContext * Method: init - * Signature: (Ljava/util/Set;)I + * Signature: (Ljava/util/Set;)V */ -JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_GLContext_init +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_init (JNIEnv *, jclass, jobject); -/* - * Class: org_lwjgl_opengl_GLContext - * Method: reinit - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GLContext_reinit - (JNIEnv *, jclass, jint); - #ifdef __cplusplus } #endif