Don't ignore lying drivers

This commit is contained in:
Elias Naur 2003-09-26 13:59:50 +00:00
parent 1f0a6136b7
commit 42ad1026af
22 changed files with 604 additions and 1667 deletions

View File

@ -36,7 +36,8 @@ import org.lwjgl.Sys;
import java.lang.reflect.*;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.HashSet;
import java.util.Iterator;
/**
* $Id$
@ -137,7 +138,6 @@ public abstract class GLCaps {
public static boolean GL_SGIS_generate_mipmap;
public static boolean GL_SGIX_shadow;
public static boolean GL_SGIX_depth_texture;
public static boolean OpenGL10;
public static boolean OpenGL11;
public static boolean OpenGL12;
public static boolean OpenGL13;
@ -158,10 +158,13 @@ public abstract class GLCaps {
System.loadLibrary(Sys.getLibraryName());
}
private static void setExtensionFields(String exts, HashMap field_map) {
StringTokenizer st = new StringTokenizer(exts);
while (st.hasMoreTokens()) {
String ext = st.nextToken();
private static void setExtensionFields(HashSet exts, HashMap field_map) {
if(org.lwjgl.Sys.DEBUG) {
System.out.println("Available extensions:");
}
Iterator it = exts.iterator();
while (it.hasNext()) {
String ext = (String)it.next();
if(org.lwjgl.Sys.DEBUG) {
System.out.println(ext);
}
@ -182,8 +185,7 @@ public abstract class GLCaps {
* Determine which extensions are available. Use this to initialize capability fields.
* Can only be called _after_ a GLWindow or Pbuffer has been created.
*/
public static void determineAvailableExtensions() {
public static void determineAvailableExtensions(HashSet exts) {
// Grab all the public static booleans out of this class
Field[] fields = GLCaps.class.getDeclaredFields();
HashMap map = new HashMap(fields.length);
@ -200,67 +202,6 @@ public abstract class GLCaps {
}
}
determineAvailableWGLExtensions(map);
String exts = CoreGL11.glGetString(CoreGL11.GL_EXTENSIONS);
if(org.lwjgl.Sys.DEBUG) {
System.out.println("Available GL extensions:");
}
setExtensionFields(exts, map);
// Let's see what openGL version we are too:
String version = CoreGL11.glGetString(CoreGL11.GL_VERSION);
int i = version.indexOf("1.");
if (i > -1) {
char c = version.charAt(i + 2);
// Each case intentionally falls through!
switch (c) {
case '4':
OpenGL14 = true;
case '3':
OpenGL13 = true;
case '2':
OpenGL12 = true;
case '1':
OpenGL11 = true;
case '0':
OpenGL10 = true;
break ;
default:
// Unexpected character - ignore
}
}
}
private static native boolean isWGLEXTExtensionsStringAvailable();
private static native boolean isWGLARBExtensionsStringAvailable();
/**
* Determine which WGL extensions are available
*/
private static void determineAvailableWGLExtensions(HashMap field_map) {
// First we must determine if WGL_EXT_extensions_string is available
WGL_ARB_extensions_string = isWGLARBExtensionsStringAvailable();
WGL_EXT_extensions_string = isWGLEXTExtensionsStringAvailable();
if (!WGL_EXT_extensions_string && !WGL_ARB_extensions_string)
return;
final String exts;
if (WGL_ARB_extensions_string)
exts = GL.wglGetExtensionsStringARB();
// Remember - this is an HWND not an HDC, which is what's required. The native
// code on the other side of wglGetExtensionsStringARB gets the HDC from the HWND
// behind the scenes.
else
exts = GL.wglGetExtensionsStringEXT();
if (exts == null)
return;
if(org.lwjgl.Sys.DEBUG) {
System.out.println("Available WGL extensions:");
}
setExtensionFields(exts, field_map);
}
}

View File

@ -24,6 +24,8 @@ package org.lwjgl.opengl;
import org.lwjgl.Display;
import org.lwjgl.Sys;
import java.util.HashSet;
public final class Window {
static {
@ -119,13 +121,13 @@ public final class Window {
return title;
}
/**
* @return whether this window is in fullscreen mode
*/
public static boolean isFullscreen() {
assert isCreated() : "Cannot determine state of uncreated window";
return fullscreen;
}
/**
* @return whether this window is in fullscreen mode
*/
public static boolean isFullscreen() {
assert isCreated() : "Cannot determine state of uncreated window";
return fullscreen;
}
/**
* Set the title of the window. This may be ignored by the underlying OS.
@ -298,11 +300,14 @@ public final class Window {
int bpp,
int alpha,
int depth,
int stencil)
int stencil,
HashSet extensions)
throws Exception;
private static void createWindow() throws Exception {
nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil);
HashSet extensions = new HashSet();
nCreate(title, x, y, width, height, fullscreen, color, alpha, depth, stencil, extensions);
GLCaps.determineAvailableExtensions(extensions);
created = true;
}

View File

@ -337,7 +337,6 @@ public class HWCursorTest {
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
//sync frame (only works on windows)
GLCaps.determineAvailableExtensions();
if (GLCaps.WGL_EXT_swap_control) {
GL.wglSwapIntervalEXT(1);
}

View File

@ -315,7 +315,6 @@ public class FullScreenWindowedTest {
GL.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
//sync frame (only works on windows)
GLCaps.determineAvailableExtensions();
if (GLCaps.WGL_EXT_swap_control) {
GL.wglSwapIntervalEXT(1);
}

View File

@ -129,7 +129,6 @@ public class Grass {
public static void main(String[] args) {
ByteBuffer byte_buf = ByteBuffer.allocateDirect(4);
byte_buf.order(ByteOrder.nativeOrder());
GLCaps.determineAvailableExtensions();
System.out.println("Vertex program supported: " + GLCaps.GL_NV_vertex_program);
GL.glGenProgramsNV(byte_buf.asIntBuffer());
IntBuffer int_buf = byte_buf.asIntBuffer();

View File

@ -386,7 +386,6 @@ public class PbufferTest {
*/
private void glInit() {
//sync frame (only works on windows)
GLCaps.determineAvailableExtensions();
if (GLCaps.WGL_EXT_swap_control) {
GL.wglSwapIntervalEXT(1);
}

View File

@ -189,7 +189,6 @@ public final class VBOIndexTest {
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
System.out.println("Timer resolution: " + Sys.getTimerResolution());
// Go into orthographic projection mode.
GLCaps.determineAvailableExtensions();
GL.glMatrixMode(GL.GL_PROJECTION);
GL.glLoadIdentity();
GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight());

View File

@ -173,7 +173,6 @@ public final class VBOTest {
Sys.setProcessPriority(Sys.HIGH_PRIORITY);
System.out.println("Timer resolution: " + Sys.getTimerResolution());
// Go into orthographic projection mode.
GLCaps.determineAvailableExtensions();
GL.glMatrixMode(GL.GL_PROJECTION);
GL.glLoadIdentity();
GLU.gluOrtho2D(0, Display.getWidth(), 0, Display.getHeight());

View File

@ -5,7 +5,7 @@ libcommon_la_SOURCES = $(COMMON)
COMMON = \
extal.cpp \
extal.h \
extgl.c \
extgl.cpp \
extgl.h \
org_lwjgl_Display.h \
org_lwjgl_Sys.h \

1108
src/native/common/extgl.c → src/native/common/extgl.cpp Normal file → Executable file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,128 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_GLCaps */
#ifndef _Included_org_lwjgl_opengl_GLCaps
#define _Included_org_lwjgl_opengl_GLCaps
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: GL_ARB_imaging */
/* Inaccessible static: GL_ARB_depth_texture */
/* Inaccessible static: GL_ARB_matrix_palette */
/* Inaccessible static: GL_ARB_multisample */
/* Inaccessible static: GL_ARB_multitexture */
/* Inaccessible static: GL_ARB_point_parameters */
/* Inaccessible static: GL_ARB_shadow */
/* Inaccessible static: GL_ARB_shadow_ambient */
/* Inaccessible static: GL_ARB_texture_compression */
/* Inaccessible static: GL_ARB_texture_env_add */
/* Inaccessible static: GL_ARB_texture_env_dot3 */
/* Inaccessible static: GL_ARB_texture_env_combine */
/* Inaccessible static: GL_ARB_texture_env_crossbar */
/* Inaccessible static: GL_ARB_texture_border_clamp */
/* Inaccessible static: GL_ARB_texture_cube_map */
/* Inaccessible static: GL_ARB_texture_mirrored_repeat */
/* Inaccessible static: GL_ARB_transpose_matrix */
/* Inaccessible static: GL_ARB_vertex_blend */
/* Inaccessible static: GL_ARB_vertex_program */
/* Inaccessible static: GL_ARB_vertex_buffer_object */
/* Inaccessible static: GL_ARB_window_pos */
/* Inaccessible static: GL_EXT_abgr */
/* Inaccessible static: GL_EXT_bgra */
/* Inaccessible static: GL_EXT_blend_color */
/* Inaccessible static: GL_EXT_blend_function_separate */
/* Inaccessible static: GL_EXT_blend_minmax */
/* Inaccessible static: GL_EXT_blend_subtract */
/* Inaccessible static: GL_EXT_compiled_vertex_array */
/* Inaccessible static: GL_EXT_cull_vertex */
/* Inaccessible static: GL_EXT_draw_range_elements */
/* Inaccessible static: GL_EXT_fog_coord */
/* Inaccessible static: GL_EXT_light_max_exponent */
/* Inaccessible static: GL_EXT_multi_draw_arrays */
/* Inaccessible static: GL_EXT_packed_pixels */
/* Inaccessible static: GL_EXT_paletted_texture */
/* Inaccessible static: GL_EXT_point_parameters */
/* Inaccessible static: GL_EXT_rescale_normal */
/* Inaccessible static: GL_EXT_secondary_color */
/* Inaccessible static: GL_EXT_separate_specular_color */
/* Inaccessible static: GL_EXT_shadow_funcs */
/* Inaccessible static: GL_EXT_shared_texture_palette */
/* Inaccessible static: GL_EXT_stencil_two_side */
/* Inaccessible static: GL_EXT_stencil_wrap */
/* Inaccessible static: GL_EXT_texture_compression_s3tc */
/* Inaccessible static: GL_EXT_texture_env_combine */
/* Inaccessible static: GL_EXT_texture_env_dot3 */
/* Inaccessible static: GL_EXT_texture_filter_anisotropic */
/* Inaccessible static: GL_EXT_texture_lod_bias */
/* Inaccessible static: GL_EXT_vertex_array */
/* Inaccessible static: GL_EXT_vertex_shader */
/* Inaccessible static: GL_EXT_vertex_weighting */
/* Inaccessible static: GL_ATI_element_array */
/* Inaccessible static: GL_ATI_envmap_bumpmap */
/* Inaccessible static: GL_ATI_fragment_shader */
/* Inaccessible static: GL_ATI_pn_triangles */
/* Inaccessible static: GL_ATI_texture_mirror_once */
/* Inaccessible static: GL_ATI_vertex_array_object */
/* Inaccessible static: GL_ATI_vertex_streams */
/* Inaccessible static: GL_ATIX_point_sprites */
/* Inaccessible static: GL_ATIX_texture_env_route */
/* Inaccessible static: GL_HP_occlusion_test */
/* Inaccessible static: GL_NV_blend_square */
/* Inaccessible static: GL_NV_copy_depth_to_color */
/* Inaccessible static: GL_NV_depth_clamp */
/* Inaccessible static: GL_NV_evaluators */
/* Inaccessible static: GL_NV_fence */
/* Inaccessible static: GL_NV_fog_distance */
/* Inaccessible static: GL_NV_light_max_exponent */
/* Inaccessible static: GL_NV_occlusion_query */
/* Inaccessible static: GL_NV_packed_depth_stencil */
/* Inaccessible static: GL_NV_point_sprite */
/* Inaccessible static: GL_NV_register_combiners */
/* Inaccessible static: GL_NV_register_combiners2 */
/* Inaccessible static: GL_NV_texgen_reflection */
/* Inaccessible static: GL_NV_texture_env_combine4 */
/* Inaccessible static: GL_NV_texture_rectangle */
/* Inaccessible static: GL_NV_texture_shader */
/* Inaccessible static: GL_NV_texture_shader2 */
/* Inaccessible static: GL_NV_texture_shader3 */
/* Inaccessible static: GL_NV_vertex_array_range */
/* Inaccessible static: GL_NV_vertex_array_range2 */
/* Inaccessible static: GL_NV_vertex_program */
/* Inaccessible static: GL_NV_vertex_program1_1 */
/* Inaccessible static: GL_SGIS_generate_mipmap */
/* Inaccessible static: GL_SGIX_shadow */
/* Inaccessible static: GL_SGIX_depth_texture */
/* Inaccessible static: OpenGL10 */
/* Inaccessible static: OpenGL11 */
/* Inaccessible static: OpenGL12 */
/* Inaccessible static: OpenGL13 */
/* Inaccessible static: OpenGL14 */
/* Inaccessible static: WGL_ARB_buffer_region */
/* Inaccessible static: WGL_ARB_extensions_string */
/* Inaccessible static: WGL_ARB_pbuffer */
/* Inaccessible static: WGL_ARB_pixel_format */
/* Inaccessible static: WGL_ARB_render_texture */
/* Inaccessible static: WGL_EXT_extensions_string */
/* Inaccessible static: WGL_EXT_swap_control */
/* Inaccessible static: class_00024org_00024lwjgl_00024opengl_00024GLCaps */
/*
* Class: org_lwjgl_opengl_GLCaps
* Method: isWGLEXTExtensionsStringAvailable
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GLCaps_isWGLEXTExtensionsStringAvailable
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_opengl_GLCaps
* Method: isWGLARBExtensionsStringAvailable
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GLCaps_isWGLARBExtensionsStringAvailable
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -88,10 +88,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers
/*
* Class: org_lwjgl_opengl_Window
* Method: nCreate
* Signature: (Ljava/lang/String;IIIIZIIII)V
* Signature: (Ljava/lang/String;IIIIZIIIILjava/util/Vector;)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
(JNIEnv *, jclass, jstring, jint, jint, jint, jint, jboolean, jint, jint, jint, jint);
(JNIEnv *, jclass, jstring, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jobject);
/*
* Class: org_lwjgl_opengl_Window

View File

@ -11,7 +11,6 @@ NATIVE = \
org_lwjgl_input_Mouse.cpp \
org_lwjgl_input_Cursor.cpp \
org_lwjgl_opengl_Window.cpp \
org_lwjgl_opengl_GLCaps.cpp \
org_lwjgl_opengl_Pbuffer.cpp \
extxcursor.cpp

View File

@ -1,62 +0,0 @@
/*
* Copyright (c) 2002 Light Weight 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.
*/
/**
* $Id$
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision$
*/
#include "org_lwjgl_opengl_GLCaps.h"
#include "extgl.h"
#include "jni.h"
/*
* Class: org_lwjgl_opengl_GLCaps
* Method: isWGLEXTExtensionsStringAvaiable
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GLCaps_isWGLEXTExtensionsStringAvailable
(JNIEnv *env, jclass clazz) {
return JNI_FALSE;
}
/*
* Class: org_lwjgl_opengl_GLCaps
* Method: isWGLARBExtensionsStringAvaiable
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GLCaps_isWGLARBExtensionsStringAvailable
(JNIEnv *env, jclass clazz) {
return JNI_FALSE;
}

View File

@ -29,7 +29,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_getPbufferCaps
(JNIEnv *env, jclass clazz)
{
// Only support thw GLX 1.3 Pbuffers and ignore the GLX_SGIX_pbuffer extension
return extgl_Extensions.glx.GLX13 ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0;
return extgl_Extensions.GLX13 ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0;
}
/*

View File

@ -51,7 +51,7 @@
#include "Window.h"
#include "org_lwjgl_opengl_Window.h"
#define USEGLX13 true
#define USEGLX13 extgl_Extensions.GLX13
static GLXContext context = NULL; // OpenGL rendering context
static GLXWindow glx_window;
@ -286,14 +286,14 @@ void throwRuntimeException(JNIEnv * env, const char * err)
}
void makeCurrent(void) {
if (USEGLX13 && extgl_Extensions.glx.GLX13)
if (USEGLX13)
glXMakeContextCurrent(getCurrentDisplay(), glx_window, glx_window, context);
else
glXMakeCurrent(getCurrentDisplay(), getCurrentWindow(), context);
}
static void releaseContext(void) {
if (USEGLX13 && extgl_Extensions.glx.GLX13)
if (USEGLX13)
glXMakeContextCurrent(getCurrentDisplay(), None, None, NULL);
else
glXMakeCurrent(getCurrentDisplay(), None, NULL);
@ -367,7 +367,7 @@ static void dumpVisualInfo(Display *disp, XVisualInfo *vis_info) {
static void destroy(void) {
releaseContext();
if (USEGLX13 && extgl_Extensions.glx.GLX13)
if (USEGLX13)
glXDestroyWindow(getCurrentDisplay(), glx_window);
glXDestroyContext(getCurrentDisplay(), context);
context = NULL;
@ -446,7 +446,7 @@ static bool initWindowGLX(JNIEnv *env, Display *disp, int screen, jstring title,
* Signature: (IIII)Z
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
(JNIEnv * env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil)
(JNIEnv * env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil, jobject ext_set)
{
int screen;
Display *disp;
@ -454,7 +454,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
if (fullscreen == JNI_TRUE)
fscreen = true;
if (extgl_Open() != 0) {
if (!extgl_Open()) {
throwException(env, "Could not load gl libs");
return;
}
@ -464,14 +464,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
return;
}
screen = XDefaultScreen(disp);
if (extgl_InitGLX(disp, screen) != 0) {
if (!extgl_InitGLX(env, ext_set, disp, screen)) {
XCloseDisplay(disp);
extgl_Close();
throwException(env, "Could not init GLX");
return;
}
bool create_success;
if (USEGLX13 && extgl_Extensions.glx.GLX13) {
if (USEGLX13) {
create_success = initWindowGLX13(env, disp, screen, title, x, y, width, height, bpp, depth, alpha, stencil, fscreen);
} else {
create_success = initWindowGLX(env, disp, screen, title, x, y, width, height, bpp, depth, alpha, stencil, fscreen);
@ -481,7 +481,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
extgl_Close();
return;
}
if (extgl_Initialize() != 0) {
if (!extgl_Initialize(env, ext_set)) {
destroy();
throwException(env, "Could not init gl function pointers");
return;
@ -511,7 +511,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers(JNIEnv * env, jclass clazz)
{
dirty = false;
if (USEGLX13 && extgl_Extensions.glx.GLX13)
if (USEGLX13)
glXSwapBuffers(getCurrentDisplay(), glx_window);
else
glXSwapBuffers(getCurrentDisplay(), getCurrentWindow());

View File

@ -11,6 +11,5 @@ NATIVE = \
# org_lwjgl_input_Mouse.cpp \
# org_lwjgl_input_Cursor.cpp \
org_lwjgl_opengl_Window.cpp
# org_lwjgl_opengl_GLCaps.cpp \
# org_lwjgl_opengl_Pbuffer.cpp

View File

@ -129,7 +129,7 @@ OSErr aehandler(const AppleEvent * theAppleEvent, AppleEvent * reply, SInt32 han
return noErr;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate(JNIEnv *env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil) {
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate(JNIEnv *env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil, jobject ext_set) {
Rect rect;
OSStatus status;
const WindowAttributes window_attr = kWindowCloseBoxAttribute|

View File

@ -1,63 +0,0 @@
/*
* Copyright (c) 2002 Light Weight 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.
*/
/**
* $Id$
*
* @author elias_naur <elias_naur@users.sourceforge.net>
* @version $Revision$
*/
#include <windows.h>
#include "org_lwjgl_opengl_GLCaps.h"
#include "extgl.h"
#include "jni.h"
/*
* Class: org_lwjgl_opengl_GLCaps
* Method: isWGLEXTExtensionsStringAvaiable
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GLCaps_isWGLEXTExtensionsStringAvailable
(JNIEnv *env, jclass clazz) {
return extgl_Extensions.wgl.EXT_extensions_string;
}
/*
* Class: org_lwjgl_opengl_GLCaps
* Method: isWGLARBExtensionsStringAvaiable
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_GLCaps_isWGLARBExtensionsStringAvailable
(JNIEnv *env, jclass clazz) {
return extgl_Extensions.wgl.ARB_extensions_string;
}

View File

@ -17,7 +17,7 @@ typedef struct _PbufferInfo {
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_Pbuffer_getPbufferCaps
(JNIEnv *env, jclass clazz)
{
return extgl_Extensions.wgl.ARB_pbuffer ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0;
return extgl_Extensions.WGL_ARB_pbuffer ? org_lwjgl_opengl_Pbuffer_PBUFFER_SUPPORTED : 0;
}
/*

View File

@ -166,7 +166,7 @@ static int findPixelFormat(JNIEnv *env, unsigned int flags, int bpp, int alpha,
}
// 4. Initialise other things now
if (extgl_Open() != 0) {
if (!extgl_Open()) {
throwException(env, "Failed to open extgl");
return -1;
}
@ -538,7 +538,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers
* Signature: (Ljava/lang/String;IIIIZIIII)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
(JNIEnv * env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil)
(JNIEnv * env, jclass clazz, jstring title, jint x, jint y, jint width, jint height, jboolean fullscreen, jint bpp, jint alpha, jint depth, jint stencil, jobject ext_set)
{
closerequested = false;
minimized = false;
@ -577,7 +577,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
wglMakeCurrent(hdc, hglrc);
// Initialise GL extensions
if (extgl_Initialize() != 0) {
if (!extgl_Initialize(env, ext_set)) {
closeWindow();
throwException(env, "Failed to initialize GL extensions");
return;