Removed unsued JNIEnv parameter from extgl_QueryExtension

This commit is contained in:
Elias Naur 2005-02-23 15:19:21 +00:00
parent c092c5f367
commit f4bfadcc5a
10 changed files with 45 additions and 47 deletions

View File

@ -46,7 +46,7 @@ bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions) {
return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions); return ext_InitializeFunctions(&extgl_GetProcAddress, num_functions, functions);
} }
bool extgl_QueryExtension(JNIEnv *env, const GLubyte*extensions, const char *name) bool extgl_QueryExtension(const GLubyte*extensions, const char *name)
{ {
const GLubyte *start; const GLubyte *start;
GLubyte *where, *terminator; GLubyte *where, *terminator;

View File

@ -72,7 +72,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
#include <jni.h> #include <jni.h>
/*-----------------------------------------*/ /*-----------------------------------------*/
/*-----------------------------------------*/ /*-----------------------------------------*/
@ -162,7 +161,7 @@ extern bool extgl_Open(JNIEnv *env);
extern void extgl_Close(void); extern void extgl_Close(void);
extern void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions); extern void extgl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions);
extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions); extern bool extgl_InitializeFunctions(int num_functions, ExtFunction *functions);
extern bool extgl_QueryExtension(JNIEnv *env, const GLubyte*extensions, const char *name); extern bool extgl_QueryExtension(const GLubyte*extensions, const char *name);
extern void *extgl_GetProcAddress(const char *name); extern void *extgl_GetProcAddress(const char *name);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -247,7 +247,7 @@ bool initPeerInfo(JNIEnv *env, jobject peer_info_handle, Display *display, int s
return false; return false;
} }
X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle); X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
if (!extgl_InitGLX(env, display, screen)) { if (!extgl_InitGLX(display, screen)) {
throwException(env, "Could not init GLX"); throwException(env, "Could not init GLX");
return false; return false;
} }

View File

@ -125,13 +125,13 @@ void extgl_Close(void)
} }
/** returns true if the extention is available */ /** returns true if the extention is available */
static bool GLXQueryExtension(JNIEnv* env, Display *disp, int screen, const char *name) static bool GLXQueryExtension(Display *disp, int screen, const char *name)
{ {
const GLubyte *exts = (const GLubyte *)glXQueryExtensionsString(disp, screen); const GLubyte *exts = (const GLubyte *)glXQueryExtensionsString(disp, screen);
return extgl_QueryExtension(env, exts, name); return extgl_QueryExtension(exts, name);
} }
static void extgl_InitGLX13(JNIEnv *env) static void extgl_InitGLX13()
{ {
ExtFunction functions[] = { ExtFunction functions[] = {
{"glXGetFBConfigs", (void*)&glXGetFBConfigs}, {"glXGetFBConfigs", (void*)&glXGetFBConfigs},
@ -182,15 +182,15 @@ static bool extgl_InitGLX12(void)
return extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); return extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
} }
static void extgl_InitGLXSupportedExtensions(JNIEnv *env, Display *disp, int screen) static void extgl_InitGLXSupportedExtensions(Display *disp, int screen)
{ {
extension_flags.GLX_EXT_visual_info = GLXQueryExtension(env, disp, screen, "GLX_EXT_visual_info"); extension_flags.GLX_EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info");
extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(env, disp, screen, "GLX_EXT_visual_rating"); extension_flags.GLX_EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating");
extension_flags.GLX_SGI_swap_control = GLXQueryExtension(env, disp, screen, "GLX_SGI_swap_control"); extension_flags.GLX_SGI_swap_control = GLXQueryExtension(disp, screen, "GLX_SGI_swap_control");
extension_flags.GLX_ARB_multisample = GLXQueryExtension(env, disp, screen, "GLX_ARB_multisample"); extension_flags.GLX_ARB_multisample = GLXQueryExtension(disp, screen, "GLX_ARB_multisample");
} }
static void extgl_InitGLXSGISwapControl(JNIEnv *env) static void extgl_InitGLXSGISwapControl()
{ {
ExtFunction functions[] = { ExtFunction functions[] = {
{"glXSwapIntervalSGI", (void*)&glXSwapIntervalSGI}}; {"glXSwapIntervalSGI", (void*)&glXSwapIntervalSGI}};
@ -198,7 +198,7 @@ static void extgl_InitGLXSGISwapControl(JNIEnv *env)
extension_flags.GLX_SGI_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); extension_flags.GLX_SGI_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
} }
bool extgl_InitGLX(JNIEnv *env, Display *disp, int screen) bool extgl_InitGLX(Display *disp, int screen)
{ {
int major, minor; int major, minor;
/* Assume glx ver >= 1.2 */ /* Assume glx ver >= 1.2 */
@ -209,8 +209,8 @@ bool extgl_InitGLX(JNIEnv *env, Display *disp, int screen)
return false; return false;
if (major > 1 || (major == 1 && minor >= 3)) if (major > 1 || (major == 1 && minor >= 3))
extension_flags.GLX13 = true; extension_flags.GLX13 = true;
extgl_InitGLX13(env); extgl_InitGLX13();
extgl_InitGLXSupportedExtensions(env, disp, screen); extgl_InitGLXSupportedExtensions(disp, screen);
extgl_InitGLXSGISwapControl(env); extgl_InitGLXSGISwapControl();
return true; return true;
} }

View File

@ -365,6 +365,6 @@ extern glXQueryExtensionsStringPROC glXQueryExtensionsString;
extern glXSwapIntervalSGIPROC glXSwapIntervalSGI; extern glXSwapIntervalSGIPROC glXSwapIntervalSGI;
extern bool extgl_InitGLX(JNIEnv *env, Display *disp, int screen); extern bool extgl_InitGLX(Display *disp, int screen);
#endif #endif

View File

@ -48,7 +48,7 @@
JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxCanvasImplementation_nFindVisualIDFromFormat
(JNIEnv *env, jclass clazz, jint screen, jobject pixel_format) { (JNIEnv *env, jclass clazz, jint screen, jobject pixel_format) {
if (!extgl_InitGLX(env, getDisplay(), screen)) { if (!extgl_InitGLX(getDisplay(), screen)) {
throwException(env, "Could not initialize GLX"); throwException(env, "Could not initialize GLX");
return -1; return -1;
} }

View File

@ -109,7 +109,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nCrea
X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle); X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_handle);
X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle); X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle);
if (!extgl_InitGLX(env, peer_info->display, peer_info->screen)) { if (!extgl_InitGLX(peer_info->display, peer_info->screen)) {
throwException(env, "Could not initialize GLX"); throwException(env, "Could not initialize GLX");
return NULL; return NULL;
} }

View File

@ -60,7 +60,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_LinuxDisplay_nGetPbufferCapabilitie
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxPbufferPeerInfo_nInitHandle
(JNIEnv *env, jclass clazz, jobject peer_info_handle, jint width, jint height, jobject pixel_format) { (JNIEnv *env, jclass clazz, jobject peer_info_handle, jint width, jint height, jobject pixel_format) {
if (!extgl_InitGLX(env, getDisplay(), getCurrentScreen()) || !isPbuffersSupported()) { if (!extgl_InitGLX(getDisplay(), getCurrentScreen()) || !isPbuffersSupported()) {
throwException(env, "No Pbuffer support"); throwException(env, "No Pbuffer support");
return; return;
} }

View File

@ -368,7 +368,7 @@ int findPixelFormatOnDC(JNIEnv *env, HDC hdc, jobject pixel_format, jobject pixe
throwException(env, "Could not bind context to dummy window"); throwException(env, "Could not bind context to dummy window");
return -1; return -1;
} }
extgl_InitWGL(env); extgl_InitWGL();
if (!extension_flags.WGL_ARB_pixel_format) { if (!extension_flags.WGL_ARB_pixel_format) {
throwException(env, "No support for WGL_ARB_pixel_format"); throwException(env, "No support for WGL_ARB_pixel_format");

View File

@ -114,7 +114,7 @@ void extgl_Close(void)
} }
/** returns true if the extension is available */ /** returns true if the extension is available */
static bool WGLQueryExtension(JNIEnv *env, const char *name) static bool WGLQueryExtension(const char *name)
{ {
const GLubyte *extensions; const GLubyte *extensions;
@ -125,10 +125,10 @@ static bool WGLQueryExtension(JNIEnv *env, const char *name)
extensions = (GLubyte*)wglGetExtensionsStringEXT(); extensions = (GLubyte*)wglGetExtensionsStringEXT();
else else
extensions = (GLubyte*)wglGetExtensionsStringARB(wglGetCurrentDC()); extensions = (GLubyte*)wglGetExtensionsStringARB(wglGetCurrentDC());
return extgl_QueryExtension(env, extensions, name); return extgl_QueryExtension(extensions, name);
} }
static void extgl_InitWGLARBPbuffer(JNIEnv *env) static void extgl_InitWGLARBPbuffer()
{ {
ExtFunction functions[] = { ExtFunction functions[] = {
{"wglCreatePbufferARB", (void **)&wglCreatePbufferARB}, {"wglCreatePbufferARB", (void **)&wglCreatePbufferARB},
@ -140,7 +140,7 @@ static void extgl_InitWGLARBPbuffer(JNIEnv *env)
extension_flags.WGL_ARB_pbuffer = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); extension_flags.WGL_ARB_pbuffer = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
} }
static void extgl_InitWGLARBPixelFormat(JNIEnv *env) static void extgl_InitWGLARBPixelFormat()
{ {
ExtFunction functions[] = { ExtFunction functions[] = {
{"wglGetPixelFormatAttribivARB", (void **)&wglGetPixelFormatAttribivARB}, {"wglGetPixelFormatAttribivARB", (void **)&wglGetPixelFormatAttribivARB},
@ -150,7 +150,7 @@ static void extgl_InitWGLARBPixelFormat(JNIEnv *env)
extension_flags.WGL_ARB_pixel_format = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); extension_flags.WGL_ARB_pixel_format = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
} }
static void extgl_InitWGLARBRenderTexture(JNIEnv *env) static void extgl_InitWGLARBRenderTexture()
{ {
ExtFunction functions[] = { ExtFunction functions[] = {
{"wglBindTexImageARB", (void **)&wglBindTexImageARB}, {"wglBindTexImageARB", (void **)&wglBindTexImageARB},
@ -160,7 +160,7 @@ static void extgl_InitWGLARBRenderTexture(JNIEnv *env)
extension_flags.WGL_ARB_render_texture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); extension_flags.WGL_ARB_render_texture = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
} }
static void extgl_InitWGLEXTSwapControl(JNIEnv *env) static void extgl_InitWGLEXTSwapControl()
{ {
ExtFunction functions[] = { ExtFunction functions[] = {
{"wglSwapIntervalEXT", (void **)&wglSwapIntervalEXT}, {"wglSwapIntervalEXT", (void **)&wglSwapIntervalEXT},
@ -169,7 +169,7 @@ static void extgl_InitWGLEXTSwapControl(JNIEnv *env)
extension_flags.WGL_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); extension_flags.WGL_EXT_swap_control = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
} }
static void extgl_InitWGLARBMakeCurrentRead(JNIEnv *env) static void extgl_InitWGLARBMakeCurrentRead()
{ {
ExtFunction functions[] = { ExtFunction functions[] = {
{"wglMakeContextCurrentARB", (void **)&wglMakeContextCurrentARB}, {"wglMakeContextCurrentARB", (void **)&wglMakeContextCurrentARB},
@ -178,20 +178,20 @@ static void extgl_InitWGLARBMakeCurrentRead(JNIEnv *env)
extension_flags.WGL_ARB_make_current_read = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions); extension_flags.WGL_ARB_make_current_read = extgl_InitializeFunctions(sizeof(functions)/sizeof(ExtFunction), functions);
} }
static void extgl_InitSupportedWGLExtensions(JNIEnv *env) static void extgl_InitSupportedWGLExtensions()
{ {
extension_flags.WGL_ARB_buffer_region = WGLQueryExtension(env, "WGL_ARB_buffer_region"); extension_flags.WGL_ARB_buffer_region = WGLQueryExtension("WGL_ARB_buffer_region");
extension_flags.WGL_ARB_make_current_read = WGLQueryExtension(env, "WGL_ARB_make_current_read"); extension_flags.WGL_ARB_make_current_read = WGLQueryExtension("WGL_ARB_make_current_read");
extension_flags.WGL_ARB_multisample = WGLQueryExtension(env, "WGL_ARB_multisample"); extension_flags.WGL_ARB_multisample = WGLQueryExtension("WGL_ARB_multisample");
extension_flags.WGL_ARB_pbuffer = WGLQueryExtension(env, "WGL_ARB_pbuffer"); extension_flags.WGL_ARB_pbuffer = WGLQueryExtension("WGL_ARB_pbuffer");
extension_flags.WGL_ARB_pixel_format = WGLQueryExtension(env, "WGL_ARB_pixel_format"); extension_flags.WGL_ARB_pixel_format = WGLQueryExtension("WGL_ARB_pixel_format");
extension_flags.WGL_ARB_render_texture = WGLQueryExtension(env, "WGL_ARB_render_texture"); extension_flags.WGL_ARB_render_texture = WGLQueryExtension("WGL_ARB_render_texture");
extension_flags.WGL_EXT_swap_control = WGLQueryExtension(env, "WGL_EXT_swap_control"); extension_flags.WGL_EXT_swap_control = WGLQueryExtension("WGL_EXT_swap_control");
extension_flags.WGL_NV_render_depth_texture = WGLQueryExtension(env, "WGL_NV_render_depth_texture"); extension_flags.WGL_NV_render_depth_texture = WGLQueryExtension("WGL_NV_render_depth_texture");
extension_flags.WGL_NV_render_texture_rectangle = WGLQueryExtension(env, "WGL_NV_render_texture_rectangle"); extension_flags.WGL_NV_render_texture_rectangle = WGLQueryExtension("WGL_NV_render_texture_rectangle");
} }
void extgl_InitWGL(JNIEnv *env) void extgl_InitWGL()
{ {
ExtFunction functions[] = { ExtFunction functions[] = {
{"wglGetExtensionsStringARB", (void **)&wglGetExtensionsStringARB}, {"wglGetExtensionsStringARB", (void **)&wglGetExtensionsStringARB},
@ -200,12 +200,11 @@ void extgl_InitWGL(JNIEnv *env)
extension_flags.WGL_ARB_extensions_string = wglGetExtensionsStringARB != NULL; extension_flags.WGL_ARB_extensions_string = wglGetExtensionsStringARB != NULL;
extension_flags.WGL_EXT_extensions_string = wglGetExtensionsStringEXT != NULL; extension_flags.WGL_EXT_extensions_string = wglGetExtensionsStringEXT != NULL;
extgl_InitSupportedWGLExtensions(env); extgl_InitSupportedWGLExtensions();
extgl_InitWGLARBMakeCurrentRead(env); extgl_InitWGLARBMakeCurrentRead();
extgl_InitWGLEXTSwapControl(env); extgl_InitWGLEXTSwapControl();
extgl_InitWGLARBRenderTexture(env); extgl_InitWGLARBRenderTexture();
extgl_InitWGLARBPixelFormat(env); extgl_InitWGLARBPixelFormat();
extgl_InitWGLARBPbuffer(env); extgl_InitWGLARBPbuffer();
//extgl_InitWGLARBBufferRegion(env);
} }