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. =)
This commit is contained in:
parent
2b814af9f7
commit
f02005efd9
|
@ -102,9 +102,27 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c
|
||||||
Colormap cmap;
|
Colormap cmap;
|
||||||
int attribmask;
|
int attribmask;
|
||||||
int bpe = bpp/4;
|
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 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;
|
int num_modes, i;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
current_fullscreen = fullscreen;
|
current_fullscreen = fullscreen;
|
||||||
current_focused = 0;
|
current_focused = 0;
|
||||||
disp = XOpenDisplay(NULL);
|
disp = XOpenDisplay(NULL);
|
||||||
|
@ -125,6 +143,12 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass c
|
||||||
root_win = RootWindow(disp, screen);
|
root_win = RootWindow(disp, screen);
|
||||||
|
|
||||||
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... */
|
||||||
|
if (vis_info == NULL) {
|
||||||
|
vis_info = glXChooseVisual(disp, screen, attriblistna);
|
||||||
|
}
|
||||||
|
|
||||||
if (vis_info == NULL) {
|
if (vis_info == NULL) {
|
||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
Loading…
Reference in New Issue