Switched to dynamic loading of gl functions and libs

This commit is contained in:
Elias Naur 2002-12-11 07:16:31 +00:00
parent 24e25533ab
commit 8202b0e14c
9 changed files with 2360 additions and 674 deletions

View File

@ -9,7 +9,6 @@
#define _GLUQuadricCallbacks_H #define _GLUQuadricCallbacks_H
#include "extgl.h" #include "extgl.h"
#include <GL/glu.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>

View File

@ -14,7 +14,6 @@
#include <jni.h> #include <jni.h>
#include "extgl.h" #include "extgl.h"
#include <GL/glu.h>
#define CHECK_GL_ERROR \ #define CHECK_GL_ERROR \
{ \ { \

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -39,14 +39,9 @@
* @version $Revision$ * @version $Revision$
*/ */
#ifdef _WIN32
#include <windows.h>
#endif
#include "org_lwjgl_opengl_GLU.h" #include "org_lwjgl_opengl_GLU.h"
#include "extgl.h" #include "extgl.h"
#include "checkGLerror.h" #include "checkGLerror.h"
#include "GL/glu.h"
#include "callbacks/GLUQuadricCallbacks.h" #include "callbacks/GLUQuadricCallbacks.h"

View File

@ -6,12 +6,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
/* Define to 1 if you have the `GL' library (-lGL). */
#undef HAVE_LIBGL
/* Define to 1 if you have the `GLU' library (-lGLU). */
#undef HAVE_LIBGLU
/* Define to 1 if you have the `openal' library (-lopenal). */ /* Define to 1 if you have the `openal' library (-lopenal). */
#undef HAVE_LIBOPENAL #undef HAVE_LIBOPENAL

View File

@ -56,12 +56,8 @@ else
fi fi
dnl Checks for libraries. dnl Checks for libraries.
dnl Replace `main' with a function in -lGL:
LIBS='-L/usr/X11R6/lib' LIBS='-L/usr/X11R6/lib'
AC_PATH_X AC_PATH_X
AC_CHECK_LIB(GL, main,, AC_MSG_ERROR(GL is required))
dnl Replace `main' with a function in -lGLU:
AC_CHECK_LIB(GLU, main,, AC_MSG_ERROR(GLU is required))
dnl Replace `main' with a function in -lX11: dnl Replace `main' with a function in -lX11:
AC_CHECK_LIB(X11, main,, AC_MSG_ERROR(X11 is required)) AC_CHECK_LIB(X11, main,, AC_MSG_ERROR(X11 is required))
dnl Replace `main' with a function in -lXext: dnl Replace `main' with a function in -lXext:

View File

@ -40,13 +40,11 @@
*/ */
#include "extgl.h"
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h> #include <X11/extensions/xf86vmode.h>
#include <GL/glx.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h> #include <stdio.h>
#include <jni.h> #include <jni.h>
#include "org_lwjgl_Display.h" #include "org_lwjgl_Display.h"
@ -144,7 +142,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c
return JNI_FALSE; return JNI_FALSE;
} }
root_win = RootWindow(disp, screen); root_win = RootWindow(disp, screen);
extgl_Open();
vis_info = glXChooseVisual(disp, screen, attriblist); vis_info = glXChooseVisual(disp, screen, attriblist);
/* might be a better way to handle not being able to set GLX_ALPHA_SIZE... */ /* might be a better way to handle not being able to set GLX_ALPHA_SIZE... */
@ -213,6 +211,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_nDestroy(JNIEnv * env, jclass claz
XFree(avail_modes); XFree(avail_modes);
XFree(vis_info); XFree(vis_info);
XCloseDisplay(disp); XCloseDisplay(disp);
extgl_Close();
#ifdef _DEBUG #ifdef _DEBUG
printf("Closed X connection\n"); printf("Closed X connection\n");
#endif #endif

View File

@ -108,7 +108,8 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
printf("Failed to set pixel format\n"); printf("Failed to set pixel format\n");
return JNI_FALSE; return JNI_FALSE;
} }
if (extgl_Open() != 0)
return JNI_FALSE;
// Create a rendering context // Create a rendering context
hglrc = wglCreateContext(hdc); hglrc = wglCreateContext(hdc);
if (hglrc == NULL) { if (hglrc == NULL) {
@ -119,6 +120,11 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
// Automatically make it the current context // Automatically make it the current context
wglMakeCurrent(hdc, hglrc); wglMakeCurrent(hdc, hglrc);
if (extgl_Initialize() != 0) {
printf("Failed to initialize GL\n");
return JNI_FALSE;
}
char * p = (char *) glGetString(GL_EXTENSIONS); char * p = (char *) glGetString(GL_EXTENSIONS);
if (NULL == p) { if (NULL == p) {
printf("NO extensions available\n"); printf("NO extensions available\n");
@ -126,11 +132,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
printf("Available extensions:\n%s\n", p); printf("Available extensions:\n%s\n", p);
} }
if (extgl_Initialize() != 0) {
printf("Failed to initialize GL\n");
return JNI_FALSE;
}
return JNI_TRUE; return JNI_TRUE;
} }
@ -147,7 +148,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroy
// Delete the rendering context // Delete the rendering context
if (hglrc != NULL) if (hglrc != NULL)
wglDeleteContext(hglrc); wglDeleteContext(hglrc);
extgl_Close();
} }
/* /*