From f02005efd9a7f456dbec320fe09898d4a53ff9ee Mon Sep 17 00:00:00 2001 From: Luke Holden Date: Tue, 26 Nov 2002 03:30:41 +0000 Subject: [PATCH] Added a fix for when GLX_ALPHA_SIZE cant be set (I think this happens when display depth is below 24.) There might be a better way to handle this... but this lets lwjgl work for me. =) --- src/native/linux/org_lwjgl_Display.cpp | 30 +++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/native/linux/org_lwjgl_Display.cpp b/src/native/linux/org_lwjgl_Display.cpp index 8afad4da..cfd90ba9 100644 --- a/src/native/linux/org_lwjgl_Display.cpp +++ b/src/native/linux/org_lwjgl_Display.cpp @@ -102,8 +102,26 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c Colormap cmap; int attribmask; int bpe = bpp/4; - int attriblist[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 24, GLX_RED_SIZE, bpe, GLX_GREEN_SIZE, bpe, GLX_BLUE_SIZE, bpe, GLX_ALPHA_SIZE, bpe, None}; - int num_modes, i; + int attriblist[] = { GLX_RGBA, + GLX_DOUBLEBUFFER, + GLX_DEPTH_SIZE, 24, + GLX_RED_SIZE, bpe, + GLX_GREEN_SIZE, bpe, + GLX_BLUE_SIZE, bpe, + GLX_ALPHA_SIZE, bpe, + None }; + int attriblistna[] = { GLX_RGBA, + GLX_DOUBLEBUFFER, + GLX_DEPTH_SIZE, 24, + GLX_RED_SIZE, bpe, + GLX_GREEN_SIZE, bpe, + GLX_BLUE_SIZE, bpe, + None }; + + int num_modes, i; + + + current_fullscreen = fullscreen; current_focused = 0; @@ -125,7 +143,13 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c root_win = RootWindow(disp, screen); vis_info = glXChooseVisual(disp, screen, attriblist); - if (vis_info == NULL) { + + /* might be a better way to handle not being able to set GLX_ALPHA_SIZE... */ + if (vis_info == NULL) { + vis_info = glXChooseVisual(disp, screen, attriblistna); + } + + if (vis_info == NULL) { XCloseDisplay(disp); #ifdef _DEBUG printf("Could not choose glx visual\n");