Added USEGLX13 to BaseGL.cpp

This commit is contained in:
Elias Naur 2003-05-30 16:29:17 +00:00
parent e66f5dee8a
commit 18685ab806
1 changed files with 7 additions and 5 deletions

View File

@ -43,18 +43,20 @@
#include "Window.h" #include "Window.h"
#include "org_lwjgl_opengl_BaseGL.h" #include "org_lwjgl_opengl_BaseGL.h"
#define USEGLX13 true
static GLXContext context = NULL; // OpenGL rendering context static GLXContext context = NULL; // OpenGL rendering context
static GLXWindow glx_window; static GLXWindow glx_window;
void makeCurrent(void) { void makeCurrent(void) {
if (extgl_Extensions.glx.GLX13) if (USEGLX13 && extgl_Extensions.glx.GLX13)
glXMakeContextCurrent(getCurrentDisplay(), glx_window, glx_window, context); glXMakeContextCurrent(getCurrentDisplay(), glx_window, glx_window, context);
else else
glXMakeCurrent(getCurrentDisplay(), getCurrentWindow(), context); glXMakeCurrent(getCurrentDisplay(), getCurrentWindow(), context);
} }
static void releaseContext(void) { static void releaseContext(void) {
if (extgl_Extensions.glx.GLX13) if (USEGLX13 && extgl_Extensions.glx.GLX13)
glXMakeContextCurrent(getCurrentDisplay(), None, None, NULL); glXMakeContextCurrent(getCurrentDisplay(), None, None, NULL);
else else
glXMakeCurrent(getCurrentDisplay(), None, NULL); glXMakeCurrent(getCurrentDisplay(), None, NULL);
@ -128,7 +130,7 @@ static void dumpVisualInfo(Display *disp, XVisualInfo *vis_info) {
static void destroy(void) { static void destroy(void) {
releaseContext(); releaseContext();
if (extgl_Extensions.glx.GLX13) if (USEGLX13 && extgl_Extensions.glx.GLX13)
glXDestroyWindow(getCurrentDisplay(), glx_window); glXDestroyWindow(getCurrentDisplay(), glx_window);
glXDestroyContext(getCurrentDisplay(), context); glXDestroyContext(getCurrentDisplay(), context);
context = NULL; context = NULL;
@ -232,7 +234,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
return; return;
} }
bool create_success; bool create_success;
if (extgl_Extensions.glx.GLX13) { if (USEGLX13 && extgl_Extensions.glx.GLX13) {
create_success = initWindowGLX13(env, disp, screen, title, x, y, width, height, bpp, depth, alpha, stencil, fscreen); create_success = initWindowGLX13(env, disp, screen, title, x, y, width, height, bpp, depth, alpha, stencil, fscreen);
} else { } else {
create_success = initWindowGLX(env, disp, screen, title, x, y, width, height, bpp, depth, alpha, stencil, fscreen); create_success = initWindowGLX(env, disp, screen, title, x, y, width, height, bpp, depth, alpha, stencil, fscreen);
@ -282,7 +284,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroyGL
*/ */
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers(JNIEnv * env, jobject obj) JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers(JNIEnv * env, jobject obj)
{ {
if (extgl_Extensions.glx.GLX13) if (USEGLX13 && extgl_Extensions.glx.GLX13)
glXSwapBuffers(getCurrentDisplay(), glx_window); glXSwapBuffers(getCurrentDisplay(), glx_window);
else else
glXSwapBuffers(getCurrentDisplay(), getCurrentWindow()); glXSwapBuffers(getCurrentDisplay(), getCurrentWindow());