Fixed: #884 24bpp support (patch provided by ThibG)

This commit is contained in:
kervala 2010-05-12 12:45:17 +02:00
parent 5ee6a11b66
commit a1ffc8c7b6
2 changed files with 16 additions and 2 deletions

View file

@ -1041,6 +1041,18 @@ bool CDriverGL::setDisplay(void *wnd, const GfxMode &mode, bool show, bool resiz
None
};
static int sAttribList24bpp[] =
{
GLX_RGBA,
GLX_DOUBLEBUFFER,
//GLX_BUFFER_SIZE, 16,
GLX_DEPTH_SIZE, 24,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
None
};
static int sAttribList32bpp[] =
{
GLX_RGBA,
@ -1054,8 +1066,10 @@ bool CDriverGL::setDisplay(void *wnd, const GfxMode &mode, bool show, bool resiz
None
};
// first try 32bpp and if that fails 16bpp
// first try 32bpp and if that fails 24bpp or 16bpp
XVisualInfo *visual_info = glXChooseVisual (dpy, DefaultScreen(dpy), sAttribList32bpp);
if (visual_info == NULL)
visual_info = glXChooseVisual(dpy, DefaultScreen(dpy), sAttribList24bpp);
if (visual_info == NULL)
visual_info = glXChooseVisual(dpy, DefaultScreen(dpy), sAttribList16bpp);
if(visual_info == NULL)

View file

@ -571,7 +571,7 @@ void checkDriverDepth ()
#ifdef NL_OS_WINDOWS
if (mode.Depth != 32)
#else
if (mode.Depth < 24)
if (mode.Depth != 16 && mode.Depth != 24 && mode.Depth != 32)
#endif
ExitClientError (CI18N::get ("uiDesktopNotIn32").toUtf8().c_str ());
}