mouse_avail = false;
}
-void VID_BuildGLXAttrib(int *attrib, qboolean stencil, qboolean stereobuffer)
+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 > 1)
+ {
+ *attrib++ = GLX_SAMPLE_BUFFERS_ARB;
+ *attrib++ = 1;
+ *attrib++ = GLX_SAMPLES_ARB;
+ *attrib++ = samples;
+ }
*attrib++ = None;
}
-int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer)
+int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer, int samples)
{
int i;
int attrib[32];
return false;
}
- VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer);
+ 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");
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);
+ Con_DPrintf("GL_EXTENSIONS: %s\n", gl_extensions);
+ Con_DPrintf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions);
+
gl_videosyncavailable = false;
// COMMANDLINEOPTION: Linux GLX: -nogetprocaddress disables GLX_ARB_get_proc_address (not required, more formal method of getting extension functions)