]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_glx.c
fix support for zip archives made by the standard Mac OSX archiver
[xonotic/darkplaces.git] / vid_glx.c
index ff98510818116e663898d39b73ba7d81776ae714..fb011d13c4dc4c5c6013813b95a3b39a2dabcfc1 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -616,20 +616,20 @@ void VID_Init(void)
 void VID_BuildGLXAttrib(int *attrib, qboolean stencil, qboolean stereobuffer, int samples)
 {
        *attrib++ = GLX_RGBA;
-       *attrib++ = GLX_RED_SIZE;*attrib++ = 1;
-       *attrib++ = GLX_GREEN_SIZE;*attrib++ = 1;
-       *attrib++ = GLX_BLUE_SIZE;*attrib++ = 1;
+       *attrib++ = GLX_RED_SIZE;*attrib++ = stencil ? 8 : 5;
+       *attrib++ = GLX_GREEN_SIZE;*attrib++ = stencil ? 8 : 5;
+       *attrib++ = GLX_BLUE_SIZE;*attrib++ = stencil ? 8 : 5;
        *attrib++ = GLX_DOUBLEBUFFER;
-       *attrib++ = GLX_DEPTH_SIZE;*attrib++ = 1;
+       *attrib++ = GLX_DEPTH_SIZE;*attrib++ = stencil ? 24 : 16;
        // if stencil is enabled, ask for alpha too
        if (stencil)
        {
                *attrib++ = GLX_STENCIL_SIZE;*attrib++ = 8;
-               *attrib++ = GLX_ALPHA_SIZE;*attrib++ = 1;
+               *attrib++ = GLX_ALPHA_SIZE;*attrib++ = 8;
        }
        if (stereobuffer)
                *attrib++ = GLX_STEREO;
-       if (samples)
+       if (samples > 1)
        {
                *attrib++ = GLX_SAMPLE_BUFFERS_ARB;
                *attrib++ = 1;
@@ -702,6 +702,13 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
 
        VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer, samples);
        visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib);
+       if (!visinfo && (samples == 1))
+       {
+                /* Some Mesa drivers reject sample buffers with 1 sample, so try
+                 * entirely without one */
+               VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer, 0);
+               visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib);
+       }
        if (!visinfo)
        {
                Con_Print("Couldn't get an RGB, Double-buffered, Depth visual\n");
@@ -855,6 +862,11 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
        gl_platform = "GLX";
        gl_platformextensions = qglXQueryExtensionsString(vidx11_display, vidx11_screen);
 
+       if (!gl_extensions)
+               gl_extensions = "";
+       if (!gl_platformextensions)
+               gl_platformextensions = "";
+
        Con_DPrintf("GL_VENDOR: %s\n", gl_vendor);
        Con_DPrintf("GL_RENDERER: %s\n", gl_renderer);
        Con_DPrintf("GL_VERSION: %s\n", gl_version);