Various linux fixes
This commit is contained in:
parent
acfd9e4cea
commit
d9828de0c4
|
@ -2484,13 +2484,11 @@ int extgl_InitGLX12(void)
|
||||||
return extgl_error;
|
return extgl_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _X11
|
|
||||||
void extgl_InitGLXSupportedExtensions(Display *disp, int screen)
|
void extgl_InitGLXSupportedExtensions(Display *disp, int screen)
|
||||||
{
|
{
|
||||||
extgl_Extensions.glx.EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info");
|
extgl_Extensions.glx.EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info");
|
||||||
extgl_Extensions.glx.EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating");
|
extgl_Extensions.glx.EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int extgl_InitGLX(Display *disp, int screen)
|
int extgl_InitGLX(Display *disp, int screen)
|
||||||
{
|
{
|
||||||
|
@ -3239,11 +3237,11 @@ int extgl_Initialize()
|
||||||
#ifdef _X11
|
#ifdef _X11
|
||||||
int extgl_Open(Display *disp, int screen)
|
int extgl_Open(Display *disp, int screen)
|
||||||
{
|
{
|
||||||
lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL);
|
lib_gl_handle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
|
||||||
if (lib_gl_handle == NULL)
|
if (lib_gl_handle == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
lib_glu_handle = dlopen("libGLU.so", RTLD_LAZY | RTLD_GLOBAL);
|
lib_glu_handle = dlopen("libGLU.so", RTLD_NOW | RTLD_GLOBAL);
|
||||||
if (lib_glu_handle == NULL)
|
if (lib_glu_handle == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
if (extgl_InitGLX(disp, screen) != 0)
|
if (extgl_InitGLX(disp, screen) != 0)
|
||||||
|
|
|
@ -6,9 +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 `openal' library (-lopenal). */
|
|
||||||
#undef HAVE_LIBOPENAL
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `X11' library (-lX11). */
|
/* Define to 1 if you have the `X11' library (-lX11). */
|
||||||
#undef HAVE_LIBX11
|
#undef HAVE_LIBX11
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ if test "x$JAVA_HOME" = x; then
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT($JAVA_HOME)
|
AC_MSG_RESULT($JAVA_HOME)
|
||||||
JAVA_HOME="$JAVA_HOME"
|
JAVA_HOME="$JAVA_HOME"
|
||||||
CPPFLAGS="$CPPFLAGS -D_X11 -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
CPPFLAGS="$CPPFLAGS -D_DEBUG -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
||||||
CFLAGS="$CFLAGS -D_X11 -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
CFLAGS="$CFLAGS -D_DEBUG -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
@ -64,8 +64,6 @@ dnl Replace `main' with a function in -lXext:
|
||||||
AC_CHECK_LIB(Xext, main,, AC_MSG_ERROR(Xext is required))
|
AC_CHECK_LIB(Xext, main,, AC_MSG_ERROR(Xext is required))
|
||||||
dnl Replace `main' with a function in -lXxf86vm:
|
dnl Replace `main' with a function in -lXxf86vm:
|
||||||
AC_CHECK_LIB(Xxf86vm, main,, AC_MSG_ERROR(Xxf86vm is required))
|
AC_CHECK_LIB(Xxf86vm, main,, AC_MSG_ERROR(Xxf86vm is required))
|
||||||
dnl Replace `main' with a function in -lopenal:
|
|
||||||
AC_CHECK_LIB(openal, main,, AC_MSG_ERROR(openal is required))
|
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ static int win_height;
|
||||||
static XF86VidModeModeInfo **avail_modes;
|
static XF86VidModeModeInfo **avail_modes;
|
||||||
static XVisualInfo * vis_info;
|
static XVisualInfo * vis_info;
|
||||||
static Atom delete_atom;
|
static Atom delete_atom;
|
||||||
static bool gl_loaded = false;
|
|
||||||
static jclass saved_clazz;
|
static jclass saved_clazz;
|
||||||
|
|
||||||
extern void handlePointerMotion(XMotionEvent *);
|
extern void handlePointerMotion(XMotionEvent *);
|
||||||
|
@ -83,70 +82,6 @@ struct pixelformat {
|
||||||
int stencil;
|
int stencil;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*static int fillFormat(struct pixelformat *formats, int index, int bpp, int depth, int alpha, int stencil) {
|
|
||||||
for (int i = 0; i < index; i++)
|
|
||||||
if (formats[i].bpp == bpp &&
|
|
||||||
formats[i].depth == depth &&
|
|
||||||
formats[i].alpha == alpha &&
|
|
||||||
formats[i].stencil == stencil)
|
|
||||||
return 0;
|
|
||||||
formats[index].bpp = bpp;
|
|
||||||
formats[index].depth = depth;
|
|
||||||
formats[index].stencil = stencil;
|
|
||||||
formats[index].alpha = alpha;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct pixelformat *getGLXAvailablePixelFormats(Display *disp, int screen, int *length) {
|
|
||||||
if (extgl_Extensions.glx.GLX13 == 1) {
|
|
||||||
int num_formats;
|
|
||||||
int attriblist[] = {GLX_DOUBLEBUFFER, True,
|
|
||||||
GLX_STEREO, False,
|
|
||||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
|
||||||
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
|
|
||||||
GLX_CONFIG_CAVEAT, GLX_NONE,
|
|
||||||
None};
|
|
||||||
GLXFBConfig *configs = glXChooseFBConfig(disp, screen, attriblist, &num_formats);
|
|
||||||
struct pixelformat *formats = (struct pixelformat *)malloc(num_formats*sizeof(struct pixelformat));
|
|
||||||
*length = 0;
|
|
||||||
for (int i = 0; i < num_formats; i++) {
|
|
||||||
int bpp, depth, alpha, stencil;
|
|
||||||
int val;
|
|
||||||
if (glXGetFBConfigAttrib(disp, configs[i], GLX_RED_SIZE, &val) != 0) {
|
|
||||||
ree(formats);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
bpp = val;
|
|
||||||
if (glXGetFBConfigAttrib(disp, configs[i], GLX_GREEN_SIZE, &val) != 0) {
|
|
||||||
free(formats);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
bpp += val;
|
|
||||||
if (glXGetFBConfigAttrib(disp, configs[i], GLX_BLUE_SIZE, &val) != 0) {
|
|
||||||
free(formats);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
bpp += val;
|
|
||||||
if (glXGetFBConfigAttrib(disp, configs[i], GLX_ALPHA_SIZE, &alpha) != 0) {
|
|
||||||
free(formats);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (glXGetFBConfigAttrib(disp, configs[i], GLX_DEPTH_SIZE, &depth) != 0) {
|
|
||||||
free(formats);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (glXGetFBConfigAttrib(disp, configs[i], GLX_STENCIL_SIZE, &stencil) != 0) {
|
|
||||||
free(formats);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (fillFormat(formats, *length, bpp, depth, alpha, stencil) == 1)
|
|
||||||
(*length)++;
|
|
||||||
}
|
|
||||||
return formats;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
static XVisualInfo *chooseVisual(Display *disp, int screen, int bpp, int depth, int alpha, int stencil) {
|
static XVisualInfo *chooseVisual(Display *disp, int screen, int bpp, int depth, int alpha, int stencil) {
|
||||||
int bpe;
|
int bpe;
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
|
@ -173,27 +108,16 @@ static XVisualInfo *chooseVisual(Display *disp, int screen, int bpp, int depth,
|
||||||
return glXChooseVisual(disp, screen, attriblist);
|
return glXChooseVisual(disp, screen, attriblist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static struct pixelformat *getAvailablePixelFormats(Display *disp, int screen, int *length) {
|
static void dumpVisualInfo(Display *disp, XVisualInfo *vis_info) {
|
||||||
struct pixelformat *formats = getGLXAvailablePixelFormats(disp, screen, length);
|
int alpha, depth, stencil, r, g, b;
|
||||||
if (formats != NULL)
|
glXGetConfig(disp, vis_info, GLX_RED_SIZE, &r);
|
||||||
return formats;
|
glXGetConfig(disp, vis_info, GLX_GREEN_SIZE, &g);
|
||||||
*length = 16;
|
glXGetConfig(disp, vis_info, GLX_BLUE_SIZE, &b);
|
||||||
formats = (struct pixelformat *)malloc((*length)*sizeof(struct pixelformat));
|
glXGetConfig(disp, vis_info, GLX_ALPHA_SIZE, &alpha);
|
||||||
*length = 0;
|
glXGetConfig(disp, vis_info, GLX_DEPTH_SIZE, &depth);
|
||||||
for (int bpp = 16; bpp <= 24; bpp += 8)
|
glXGetConfig(disp, vis_info, GLX_STENCIL_SIZE, &stencil);
|
||||||
for (int depth = 16; depth <= 24; depth += 8)
|
printf("Pixel format chosen sizes: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d\n", r, g, b, alpha, depth, stencil);
|
||||||
for (int alpha = 0; alpha <= 8; alpha += 8)
|
|
||||||
for (int stencil = 0; stencil <= 8; stencil += 8) {
|
|
||||||
XVisualInfo * visual = chooseVisual(disp, screen, bpp, depth, alpha, stencil);
|
|
||||||
if (visual != NULL) {
|
|
||||||
if (fillFormat(formats, *length, bpp, depth, alpha, stencil) == 1)
|
|
||||||
(*length)++;
|
|
||||||
XFree(visual);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return formats;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
static void waitMapped(Display *disp, Window win) {
|
static void waitMapped(Display *disp, Window win) {
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
@ -234,7 +158,7 @@ void handleMessages(JNIEnv *env) {
|
||||||
XNextEvent(disp, &event);
|
XNextEvent(disp, &event);
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
if ((event.xclient.format == 32) && (event.xclient.data.l[0] == delete_atom))
|
if ((event.xclient.format == 32) && ((Atom)event.xclient.data.l[0] == delete_atom))
|
||||||
env->SetStaticBooleanField(saved_clazz, fid_close, JNI_TRUE);
|
env->SetStaticBooleanField(saved_clazz, fid_close, JNI_TRUE);
|
||||||
break;
|
break;
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
|
@ -264,20 +188,16 @@ void handleMessages(JNIEnv *env) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool loadGL(Display *disp, int screen) {
|
static bool loadGL(Display *disp, int screen) {
|
||||||
if (gl_loaded == true)
|
|
||||||
return true;
|
|
||||||
if (extgl_Open(disp, screen) != 0) {
|
if (extgl_Open(disp, screen) != 0) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Could not load gl libs\n");
|
printf("Could not load gl libs\n");
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
gl_loaded = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void closeGL(void) {
|
static void closeGL(void) {
|
||||||
gl_loaded = false;
|
|
||||||
extgl_Close();
|
extgl_Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,6 +293,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c
|
||||||
}
|
}
|
||||||
root_win = RootWindow(disp, screen);
|
root_win = RootWindow(disp, screen);
|
||||||
vis_info = chooseVisual(disp, screen, bpp, depth_bits, alpha_bits, stencil_bits);
|
vis_info = chooseVisual(disp, screen, bpp, depth_bits, alpha_bits, stencil_bits);
|
||||||
|
XSync(disp, False);
|
||||||
if (vis_info == NULL) {
|
if (vis_info == NULL) {
|
||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -380,7 +301,9 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c
|
||||||
#endif
|
#endif
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
#ifdef _DEBUG
|
||||||
|
dumpVisualInfo(disp, vis_info);
|
||||||
|
#endif
|
||||||
cmap = XCreateColormap(disp, root_win, vis_info->visual, AllocNone);
|
cmap = XCreateColormap(disp, root_win, vis_info->visual, AllocNone);
|
||||||
attribs.colormap = cmap;
|
attribs.colormap = cmap;
|
||||||
attribs.event_mask = FocusChangeMask | VisibilityChangeMask| StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
|
attribs.event_mask = FocusChangeMask | VisibilityChangeMask| StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
|
||||||
|
@ -391,6 +314,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c
|
||||||
attribs.override_redirect = True;
|
attribs.override_redirect = True;
|
||||||
}
|
}
|
||||||
win = XCreateWindow(disp, root_win, 0, 0, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs);
|
win = XCreateWindow(disp, root_win, 0, 0, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs);
|
||||||
|
XFreeColormap(disp, cmap);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Created window\n");
|
printf("Created window\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -425,6 +349,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c
|
||||||
#endif
|
#endif
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XF86VidModeSetViewPort(disp, screen, 0, 0);
|
XF86VidModeSetViewPort(disp, screen, 0, 0);
|
||||||
|
@ -446,8 +371,11 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_nDestroy(JNIEnv * env, jclass claz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XFree(avail_modes);
|
XFree(avail_modes);
|
||||||
|
avail_modes = NULL;
|
||||||
XFree(vis_info);
|
XFree(vis_info);
|
||||||
|
vis_info = NULL;
|
||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
|
disp = NULL;
|
||||||
closeGL();
|
closeGL();
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Closed X connection\n");
|
printf("Closed X connection\n");
|
||||||
|
@ -479,13 +407,6 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes
|
||||||
screen = DefaultScreen(disp);
|
screen = DefaultScreen(disp);
|
||||||
int bpp = XDefaultDepth(disp, screen);
|
int bpp = XDefaultDepth(disp, screen);
|
||||||
|
|
||||||
if (!loadGL(disp, screen)) {
|
|
||||||
#ifdef _DEBUG
|
|
||||||
printf("Could not load GL\n");
|
|
||||||
#endif
|
|
||||||
XCloseDisplay(disp);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) {
|
if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Could not get display modes\n");
|
printf("Could not get display modes\n");
|
||||||
|
@ -493,22 +414,15 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes
|
||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int num_pixelformats;
|
|
||||||
// struct pixelformat *formats = getAvailablePixelFormats(disp, screen, &num_pixelformats);
|
|
||||||
// Allocate an array of DisplayModes big enough
|
// Allocate an array of DisplayModes big enough
|
||||||
jclass displayModeClass = env->FindClass("org/lwjgl/DisplayMode");
|
jclass displayModeClass = env->FindClass("org/lwjgl/DisplayMode");
|
||||||
jobjectArray ret = env->NewObjectArray(num_modes/**num_pixelformats*/, displayModeClass, NULL);
|
jobjectArray ret = env->NewObjectArray(num_modes, displayModeClass, NULL);
|
||||||
jmethodID displayModeConstructor = env->GetMethodID(displayModeClass, "<init>", "(IIII)V");
|
jmethodID displayModeConstructor = env->GetMethodID(displayModeClass, "<init>", "(IIII)V");
|
||||||
|
|
||||||
for (i = 0; i < num_modes; i++) {
|
for (i = 0; i < num_modes; i++) {
|
||||||
/* for (int j = 0; j < num_pixelformats; j++) {
|
|
||||||
jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay, formats[j].bpp, 0, formats[j].alpha, formats[j].depth, formats[j].stencil);
|
|
||||||
env->SetObjectArrayElement(ret, i*num_pixelformats + j, displayMode);
|
|
||||||
}*/
|
|
||||||
jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay, bpp, 0);
|
jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay, bpp, 0);
|
||||||
env->SetObjectArrayElement(ret, i, displayMode);
|
env->SetObjectArrayElement(ret, i, displayMode);
|
||||||
}
|
}
|
||||||
// free(formats);
|
|
||||||
XFree(avail_modes);
|
XFree(avail_modes);
|
||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -257,9 +257,6 @@ void handleKeyEvent(XKeyEvent *event) {
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll
|
||||||
(JNIEnv * env, jclass clazz, jint buf)
|
(JNIEnv * env, jclass clazz, jint buf)
|
||||||
{
|
{
|
||||||
XEvent event;
|
|
||||||
unsigned char state;
|
|
||||||
|
|
||||||
handleMessages(env);
|
handleMessages(env);
|
||||||
updateGrab();
|
updateGrab();
|
||||||
memcpy((unsigned char*)buf, key_buf, KEYBOARD_SIZE*sizeof(unsigned char));
|
memcpy((unsigned char*)buf, key_buf, KEYBOARD_SIZE*sizeof(unsigned char));
|
||||||
|
@ -273,10 +270,8 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll
|
||||||
JNIEXPORT int JNICALL Java_org_lwjgl_input_Keyboard_nRead
|
JNIEXPORT int JNICALL Java_org_lwjgl_input_Keyboard_nRead
|
||||||
(JNIEnv * env, jclass clazz)
|
(JNIEnv * env, jclass clazz)
|
||||||
{
|
{
|
||||||
XEvent event;
|
|
||||||
XKeyEvent *key_event;
|
XKeyEvent *key_event;
|
||||||
int buf_count = 0;
|
int buf_count = 0;
|
||||||
int state;
|
|
||||||
int num_events = 0;
|
int num_events = 0;
|
||||||
|
|
||||||
handleMessages(env);
|
handleMessages(env);
|
||||||
|
|
|
@ -65,15 +65,20 @@ static void releaseContext(void) {
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
|
||||||
(JNIEnv * env, jobject obj)
|
(JNIEnv * env, jobject obj)
|
||||||
{
|
{
|
||||||
|
if (disp == NULL) {
|
||||||
if (!getVisualInfo()) {
|
#ifdef _DEBUG
|
||||||
|
printf("No display\n");
|
||||||
|
#endif
|
||||||
|
return JNI_FALSE;
|
||||||
|
}
|
||||||
|
if (getVisualInfo() == NULL) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("No visual info\n");
|
printf("No visual info\n");
|
||||||
#endif
|
#endif
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
context = glXCreateContext(disp, getVisualInfo(), NULL, True);
|
context = glXCreateContext(disp, getVisualInfo(), NULL, True);
|
||||||
if (!context) {
|
if (context == NULL) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Could not create context\n");
|
printf("Could not create context\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -103,9 +108,8 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroy
|
||||||
(JNIEnv * env, jobject obj)
|
(JNIEnv * env, jobject obj)
|
||||||
{
|
{
|
||||||
releaseContext();
|
releaseContext();
|
||||||
// Delete the rendering context
|
glXDestroyContext(disp, context);
|
||||||
if (context != NULL)
|
context = NULL;
|
||||||
glXDestroyContext(disp, context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue