diff --git a/src/java/org/lwjgl/AWTAdapter.java b/src/java/org/lwjgl/AWTAdapter.java new file mode 100644 index 00000000..3ad30970 --- /dev/null +++ b/src/java/org/lwjgl/AWTAdapter.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2002 Lightweight Java Game Library Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'Light Weight Java Game Library' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl; + +import javax.swing.JOptionPane; + +/** + * $Id$ + * + * An AWT adapter for using AWT to take care of things on platforms where we + * know AWT is present. + *
Note To compile LWJGL applications with Excelsior JET that use JetPerfect
+ * and that have no dependencies on AWT, do not include this class in your
+ * JET project.
+ *
+ * @author cix_foo
* The alert should display the title and the message and then the current
* thread should block until the user dismisses the alert - typically with an
* OK button click.
- *
+ *
* It may be that the user's system has no windowing system installed for some
* reason, in which case this method may do nothing at all, or attempt to provide
* some console output.
@@ -201,31 +202,41 @@ public final class Sys {
* @param title The title of the alert. We suggest using the title of your game.
* @param message The message text for the alert.
*/
- public static native void alert(String title, String message);
-
- /*
- * Cas: this is just a debugging aid. The native code is also commented out.
- *
- public static native int getDirectBufferAddress(Buffer buf);
- */
+ public static void alert(String title, String message) {
+ String osName = System.getProperty("os.name");
+ if (osName.startsWith("Windoxws")) {
+ nAlert(title, message);
+ } else {
+ try {
+ Adapter adapter = (Adapter) Class.forName("org.lwjgl.AWTAdapter").newInstance(); // This avoids a Jet error message
+ adapter.alert(title, message);
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ }
+ }
+ }
+
+ private static native void nAlert(String title, String message);
/**
* Open the system web browser and point it at the specified URL. It is recommended
* that this not be called whilst your game is running, but on application exit in
* a shutdown hook, as the screen resolution will not be reset when the browser is
* brought into view.
- *
+ *
* There is no guarantee that this will work, nor that we can detect if it has
* failed - hence we don't return success code or throw an Exception. This is just a
* best attempt at opening the URL given - don't rely on it to work!
+ *
* @param url The URL
+ * @return false if we are CERTAIN the call has failed
*/
- public static void openURL(String url) {
+ public static boolean openURL(String url) {
String osName = System.getProperty("os.name");
if (osName.startsWith("Mac OS") || osName.startsWith("Windows")) {
// Mac and Windows both do this nicely from native code.
nOpenURL(url);
- return;
+ return true;
}
// Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it
// right anyway.
@@ -235,12 +246,15 @@ public final class Sys {
for (int i = 0; i < browsers.length; i ++) {
try {
Runtime.getRuntime().exec(new String[] { browsers[i], url });
- break;
+ return true;
} catch (IOException e) {
// Ignore
e.printStackTrace(System.err);
}
}
+
+ // Seems to have failed
+ return false;
}
diff --git a/src/java/org/lwjgl/opengl/GLContext.java b/src/java/org/lwjgl/opengl/GLContext.java
index 5d60cb44..ef70daf4 100644
--- a/src/java/org/lwjgl/opengl/GLContext.java
+++ b/src/java/org/lwjgl/opengl/GLContext.java
@@ -36,7 +36,7 @@ import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.HashMap;
-import java.util.Iterator;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -60,6 +60,9 @@ public final class GLContext {
/** 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
*/
@@ -132,9 +135,6 @@ public final class GLContext {
public static boolean GL_ATI_vertex_streams;
public static boolean GL_ATI_separate_stencil;
- public static boolean GL_ATIX_point_sprites;
- public static boolean GL_ATIX_texture_env_route;
-
public static boolean GL_NV_blend_square;
public static boolean GL_NV_copy_depth_to_color;
public static boolean GL_NV_depth_clamp;
@@ -177,25 +177,6 @@ public final class GLContext {
System.loadLibrary(Sys.getLibraryName());
}
- private static void setExtensionFields(Set exts, HashMap field_map) {
- Sys.log("Available extensions:");
- Iterator it = exts.iterator();
- while ( it.hasNext() ) {
- String ext = (String)it.next();
- Sys.log(ext);
-
- Field f = (Field)field_map.get(ext);
- if ( f != null ) {
- try {
- f.setBoolean(GLContext.class, true);
- } catch (IllegalAccessException e) {
- e.printStackTrace(System.err);
- }
- }
-
- }
- }
-
/**
* Determine which extensions are available. Use this to initialize capability fields. Can only be
* called _after_ a GLWindow or Pbuffer has been created (or a context from some other GL library).
@@ -204,23 +185,19 @@ public final class GLContext {
*
* @param exts A Set of OpenGL extension string names
*/
- public static void determineAvailableExtensions(Set exts) {
+ private static void determineAvailableExtensions(Set exts) {
// Grab all the public static booleans out of this class
Field[] fields = GLContext.class.getDeclaredFields();
- HashMap map = new HashMap(fields.length);
for ( int i = 0; i < fields.length; i++ ) {
if ( Modifier.isStatic(fields[i].getModifiers()) && fields[i].getType() == boolean.class ) {
- map.put(fields[i].getName(), fields[i]);
// reset fields
try {
- fields[i].setBoolean(GLContext.class, false);
+ fields[i].setBoolean(GLContext.class, exts.contains(fields[i].getName()));
} catch (IllegalAccessException e) {
e.printStackTrace(System.err);
}
}
}
-
- setExtensionFields(exts, map);
}
/**
@@ -248,27 +225,30 @@ public final class GLContext {
// 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 {
- contextMap.put(currentContext, new Integer(init()));
+ exts = new HashSet();
+ contextMap.put(currentContext, new Integer(init(exts)));
}
- // Now determine the available extensions
-
+ determineAvailableExtensions(exts);
}
/**
* Native method to initialize a context from scratch or load its function pointers from a
* cache.
+ * @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();
+ 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 int reinit(int context);
+ private static native void reinit(int context);
}
diff --git a/src/java/org/lwjgl/opengl/Window.java b/src/java/org/lwjgl/opengl/Window.java
index a81a6c26..21886231 100644
--- a/src/java/org/lwjgl/opengl/Window.java
+++ b/src/java/org/lwjgl/opengl/Window.java
@@ -308,16 +308,13 @@ public final class Window {
int alpha,
int depth,
int stencil,
- int samples,
- HashSet extensions)
+ int samples)
throws Exception;
private static void createWindow(int bpp, int alpha, int depth, int stencil, int samples) throws Exception {
- HashSet extensions = new HashSet();
- nCreate(title, x, y, width, height, fullscreen, bpp, alpha, depth, stencil, samples, extensions);
+ nCreate(title, x, y, width, height, fullscreen, bpp, alpha, depth, stencil, samples);
context = new Window();
makeCurrent();
- GLContext.determineAvailableExtensions(extensions);
}
/**
diff --git a/src/java/org/lwjgl/test/SysTest.java b/src/java/org/lwjgl/test/SysTest.java
index 516833f1..538078e7 100644
--- a/src/java/org/lwjgl/test/SysTest.java
+++ b/src/java/org/lwjgl/test/SysTest.java
@@ -54,10 +54,10 @@ public class SysTest {
* Runs the tests
*/
public void executeTest() {
- testDebug();
+ testAlert();
+ testDebug();
testTimer();
testPriority();
- testAlert();
testUrl();
}
diff --git a/src/native/common/extgl.cpp b/src/native/common/extgl.cpp
index 4ade672b..582117d4 100755
--- a/src/native/common/extgl.cpp
+++ b/src/native/common/extgl.cpp
@@ -719,7 +719,7 @@ void *extgl_GetProcAddress(const char *name)
#endif
#ifdef _AGL
- CFStringRef str = CFStringCreateWithCStringNoCopy(NULL, name, kCFStringEncodingUTF8, kCFAllocatorNull);
+ CFStringRef str = CFStringCreateWithCStringNoCopy(NULL, name, kCFStringEncodingUTF8, kCFAllocatorNULL);
void *func_pointer = CFBundleGetFunctionPointerForName(opengl_bundle_ref, str);
if (func_pointer == NULL) {
func_pointer = CFBundleGetFunctionPointerForName(agl_bundle_ref, str);
@@ -785,7 +785,9 @@ static bool QueryExtension(JNIEnv *env, jobject ext_set, const GLubyte*extension
if (*terminator == ' ' || *terminator == '\0') {
- insertExtension(env, ext_set, name);
+ if (ext_set != NULL) {
+ insertExtension(env, ext_set, name);
+ }
return true;
@@ -806,7 +808,7 @@ static bool QueryExtension(JNIEnv *env, jobject ext_set, const GLubyte*extension
#ifdef _WIN32
/** returns true if the extention is available */
-static bool WGLQueryExtension(JNIEnv *env, jobject ext_set, const char *name)
+static bool WGLQueryExtension(JNIEnv *env, const char *name)
{
const GLubyte *extensions;
@@ -817,10 +819,10 @@ static bool WGLQueryExtension(JNIEnv *env, jobject ext_set, const char *name)
extensions = (GLubyte*)wglGetExtensionsStringEXT();
else
extensions = (GLubyte*)wglGetExtensionsStringARB(wglGetCurrentDC());
- return QueryExtension(env, ext_set, extensions, name);
+ return QueryExtension(env, NULL, extensions, name);
}
-static void extgl_InitWGLARBBufferRegion(JNIEnv *env, jobject ext_set)
+static void extgl_InitWGLARBBufferRegion(JNIEnv *env)
{
if (!extgl_Extensions.WGL_ARB_buffer_region)
return;
@@ -829,10 +831,10 @@ static void extgl_InitWGLARBBufferRegion(JNIEnv *env, jobject ext_set)
wglSaveBufferRegionARB = (wglSaveBufferRegionARBPROC) extgl_GetProcAddress("wglSaveBufferRegionARB");
wglRestoreBufferRegionARB = (wglRestoreBufferRegionARBPROC) extgl_GetProcAddress("wglRestoreBufferRegionARB");
- EXTGL_SANITY_CHECK(env, ext_set, WGL_ARB_buffer_region);
+ EXTGL_SANITY_CHECK(env, NULL, WGL_ARB_buffer_region);
}
-static void extgl_InitWGLARBPbuffer(JNIEnv *env, jobject ext_set)
+static void extgl_InitWGLARBPbuffer(JNIEnv *env)
{
if (!extgl_Extensions.WGL_ARB_pbuffer)
return;
@@ -841,66 +843,66 @@ static void extgl_InitWGLARBPbuffer(JNIEnv *env, jobject ext_set)
wglReleasePbufferDCARB = (wglReleasePbufferDCARBPROC) extgl_GetProcAddress("wglReleasePbufferDCARB");
wglDestroyPbufferARB = (wglDestroyPbufferARBPROC) extgl_GetProcAddress("wglDestroyPbufferARB");
wglQueryPbufferARB = (wglQueryPbufferARBPROC) extgl_GetProcAddress("wglQueryPbufferARB");
- EXTGL_SANITY_CHECK(env, ext_set, WGL_ARB_pbuffer);
+ EXTGL_SANITY_CHECK(env, NULL, WGL_ARB_pbuffer);
}
-static void extgl_InitWGLARBPixelFormat(JNIEnv *env, jobject ext_set)
+static void extgl_InitWGLARBPixelFormat(JNIEnv *env)
{
if (!extgl_Extensions.WGL_ARB_pixel_format)
return;
wglGetPixelFormatAttribivARB = (wglGetPixelFormatAttribivARBPROC) extgl_GetProcAddress("wglGetPixelFormatAttribivARB");
wglGetPixelFormatAttribfvARB = (wglGetPixelFormatAttribfvARBPROC) extgl_GetProcAddress("wglGetPixelFormatAttribfvARB");
wglChoosePixelFormatARB = (wglChoosePixelFormatARBPROC) extgl_GetProcAddress("wglChoosePixelFormatARB");
- EXTGL_SANITY_CHECK(env, ext_set, WGL_ARB_pixel_format);
+ EXTGL_SANITY_CHECK(env, NULL, WGL_ARB_pixel_format);
}
-static void extgl_InitWGLARBRenderTexture(JNIEnv *env, jobject ext_set)
+static void extgl_InitWGLARBRenderTexture(JNIEnv *env)
{
if (!extgl_Extensions.WGL_ARB_render_texture)
return;
wglBindTexImageARB = (wglBindTexImageARBPROC) extgl_GetProcAddress("wglBindTexImageARB");
wglReleaseTexImageARB = (wglReleaseTexImageARBPROC) extgl_GetProcAddress("wglReleaseTexImageARB");
wglSetPbufferAttribARB = (wglSetPbufferAttribARBPROC) extgl_GetProcAddress("wglSetPbufferAttribARB");
- EXTGL_SANITY_CHECK(env, ext_set, WGL_ARB_render_texture);
+ EXTGL_SANITY_CHECK(env, NULL, WGL_ARB_render_texture);
}
-static void extgl_InitWGLEXTSwapControl(JNIEnv *env, jobject ext_set)
+static void extgl_InitWGLEXTSwapControl(JNIEnv *env)
{
if (!extgl_Extensions.WGL_EXT_swap_control)
return;
wglSwapIntervalEXT = (wglSwapIntervalEXTPROC) extgl_GetProcAddress("wglSwapIntervalEXT");
wglGetSwapIntervalEXT = (wglGetSwapIntervalEXTPROC) extgl_GetProcAddress("wglGetSwapIntervalEXT");
- EXTGL_SANITY_CHECK(env, ext_set, WGL_EXT_swap_control);
+ EXTGL_SANITY_CHECK(env, NULL, WGL_EXT_swap_control);
}
-static void extgl_InitWGLARBMakeCurrentRead(JNIEnv *env, jobject ext_set)
+static void extgl_InitWGLARBMakeCurrentRead(JNIEnv *env)
{
if (!extgl_Extensions.WGL_ARB_make_current_read)
return;
wglMakeContextCurrentARB = (wglMakeContextCurrentARBPROC) extgl_GetProcAddress("wglMakeContextCurrentARB");
wglGetCurrentReadDCARB = (wglGetCurrentReadDCARBPROC) extgl_GetProcAddress("wglGetCurrentReadDCARB");
- EXTGL_SANITY_CHECK(env, ext_set, WGL_ARB_make_current_read);
+ EXTGL_SANITY_CHECK(env, NULL, WGL_ARB_make_current_read);
}
-static void extgl_InitSupportedWGLExtensions(JNIEnv *env, jobject ext_set)
+static void extgl_InitSupportedWGLExtensions(JNIEnv *env)
{
- extgl_Extensions.WGL_ARB_buffer_region = WGLQueryExtension(env, ext_set, "WGL_ARB_buffer_region");
- extgl_Extensions.WGL_ARB_make_current_read = WGLQueryExtension(env, ext_set, "WGL_ARB_make_current_read");
- extgl_Extensions.WGL_ARB_multisample = WGLQueryExtension(env, ext_set, "WGL_ARB_multisample");
- extgl_Extensions.WGL_ARB_pbuffer = WGLQueryExtension(env, ext_set, "WGL_ARB_pbuffer");
- extgl_Extensions.WGL_ARB_pixel_format = WGLQueryExtension(env, ext_set, "WGL_ARB_pixel_format");
- extgl_Extensions.WGL_ARB_render_texture = WGLQueryExtension(env, ext_set, "WGL_ARB_render_texture");
- extgl_Extensions.WGL_EXT_swap_control = WGLQueryExtension(env, ext_set, "WGL_EXT_swap_control");
- extgl_Extensions.WGL_NV_render_depth_texture = WGLQueryExtension(env, ext_set, "WGL_NV_render_depth_texture");
- extgl_Extensions.WGL_NV_render_texture_rectangle = WGLQueryExtension(env, ext_set, "WGL_NV_render_texture_rectangle");
+ extgl_Extensions.WGL_ARB_buffer_region = WGLQueryExtension(env, "WGL_ARB_buffer_region");
+ extgl_Extensions.WGL_ARB_make_current_read = WGLQueryExtension(env, "WGL_ARB_make_current_read");
+ extgl_Extensions.WGL_ARB_multisample = WGLQueryExtension(env, "WGL_ARB_multisample");
+ extgl_Extensions.WGL_ARB_pbuffer = WGLQueryExtension(env, "WGL_ARB_pbuffer");
+ extgl_Extensions.WGL_ARB_pixel_format = WGLQueryExtension(env, "WGL_ARB_pixel_format");
+ extgl_Extensions.WGL_ARB_render_texture = WGLQueryExtension(env, "WGL_ARB_render_texture");
+ extgl_Extensions.WGL_EXT_swap_control = WGLQueryExtension(env, "WGL_EXT_swap_control");
+ extgl_Extensions.WGL_NV_render_depth_texture = WGLQueryExtension(env, "WGL_NV_render_depth_texture");
+ extgl_Extensions.WGL_NV_render_texture_rectangle = WGLQueryExtension(env, "WGL_NV_render_texture_rectangle");
}
-void extgl_InitWGL(JNIEnv *env, jobject ext_set)
+void extgl_InitWGL(JNIEnv *env)
{
wglGetExtensionsStringARB = (wglGetExtensionsStringARBPROC) extgl_GetProcAddress("wglGetExtensionsStringARB");
wglGetExtensionsStringEXT = (wglGetExtensionsStringEXTPROC) extgl_GetProcAddress("wglGetExtensionsStringEXT");
@@ -908,14 +910,14 @@ void extgl_InitWGL(JNIEnv *env, jobject ext_set)
extgl_Extensions.WGL_EXT_extensions_string = wglGetExtensionsStringEXT != NULL;
extgl_error = false;
- extgl_InitSupportedWGLExtensions(env, ext_set);
+ extgl_InitSupportedWGLExtensions(env);
- extgl_InitWGLARBMakeCurrentRead(env, ext_set);
- extgl_InitWGLEXTSwapControl(env, ext_set);
- extgl_InitWGLARBRenderTexture(env, ext_set);
- extgl_InitWGLARBPixelFormat(env, ext_set);
- extgl_InitWGLARBPbuffer(env, ext_set);
- extgl_InitWGLARBBufferRegion(env, ext_set);
+ extgl_InitWGLARBMakeCurrentRead(env);
+ extgl_InitWGLEXTSwapControl(env);
+ extgl_InitWGLARBRenderTexture(env);
+ extgl_InitWGLARBPixelFormat(env);
+ extgl_InitWGLARBPbuffer(env);
+ extgl_InitWGLARBBufferRegion(env);
}
#endif /* WIN32 */
diff --git a/src/native/common/extgl.h b/src/native/common/extgl.h
index 1bec3b74..b00e5d8b 100644
--- a/src/native/common/extgl.h
+++ b/src/native/common/extgl.h
@@ -3278,13 +3278,13 @@ extern glGetStringPROC glGetString;
bool extgl_Initialize(JNIEnv *env, jobject gl_extensions);
bool extgl_Open(void);
#ifdef _WIN32
-void extgl_InitWGL(JNIEnv *env, jobject ext_set);
+void extgl_InitWGL(JNIEnv *env);
#endif
#ifdef _X11
-bool extgl_InitGLX(JNIEnv *env, jobject ext_set, Display *disp, int screen);
+bool extgl_InitGLX(JNIEnv *env, Display *disp, int screen);
#endif
#ifdef _AGL
-bool extgl_InitAGL(JNIEnv *env, jobject ext_set);
+bool extgl_InitAGL(JNIEnv *env);
#endif
void *extgl_GetProcAddress(const char *name);
void extgl_Close(void);
@@ -3294,7 +3294,9 @@ void extgl_removeExtension(JNIEnv *env, jobject ext_set, const char *ext);
extgl_Extensions.x = 0; \
printf("NOTICE: %s disabled because of missing driver symbols\n", #x); \
extgl_error = false; \
- extgl_removeExtension(e, h, #x); \
+ if (h != NULL) { \
+ extgl_removeExtension(e, h, #x); \
+ } \
}
#ifdef __cplusplus
}
diff --git a/src/native/common/org_lwjgl_opengl_GLContext.cpp b/src/native/common/org_lwjgl_opengl_GLContext.cpp
new file mode 100644
index 00000000..e671b074
--- /dev/null
+++ b/src/native/common/org_lwjgl_opengl_GLContext.cpp
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 Lightweight Java Game Library Project
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+*
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+*
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* * Neither the name of 'Light Weight Java Game Library' nor the names of
+* its contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "org_lwjgl_opengl_GLContext.h"
+#include "extgl.h"
+#include "checkGLerror.h"
+
+/*
+ * Class: org_lwjgl_opengl_GLContext
+ * Method: init
+ * Signature: (Ljava/util/Set;)I
+ */
+JNIEXPORT jint 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
new file mode 100644
index 00000000..e643ade9
--- /dev/null
+++ b/src/native/common/org_lwjgl_opengl_GLContext.h
@@ -0,0 +1,138 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include