]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_glx.c
implemented vid_samples cvar (antialiasing samples per pixel)
[xonotic/darkplaces.git] / vid_glx.c
index 02911ed859ace7808796cf6a4a4c9742ca233d80..ff98510818116e663898d39b73ba7d81776ae714 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -89,6 +89,7 @@ Atom wm_delete_window_atom;
 
 static qboolean mouse_avail = true;
 static qboolean vid_usingmouse = false;
+static qboolean vid_usingdgamouse = false;
 static qboolean vid_usingvsync = false;
 static qboolean vid_usevsync = false;
 static qboolean vid_x11_hardwaregammasupported = false;
@@ -254,6 +255,10 @@ static void IN_Activate (qboolean grab)
                return;
        if (grab)
        {
+#if !defined(__APPLE__) && !defined(SUNOS)
+               if(vid_usingmouse && (vid_usingdgamouse != !!vid_dgamouse.integer))
+                       IN_Activate(false); // ungrab first!
+#endif
                if (!vid_usingmouse && mouse_avail && win)
                {
                        XWindowAttributes attribs_1;
@@ -284,6 +289,7 @@ static void IN_Activate (qboolean grab)
                        mouse_x = mouse_y = 0;
                        cl_ignoremousemoves = 2;
                        vid_usingmouse = true;
+                       vid_usingdgamouse = !!vid_dgamouse.integer;
                }
        }
        else
@@ -607,7 +613,7 @@ void VID_Init(void)
                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;
@@ -623,10 +629,17 @@ void VID_BuildGLXAttrib(int *attrib, qboolean stencil, qboolean stereobuffer)
        }
        if (stereobuffer)
                *attrib++ = GLX_STEREO;
+       if (samples)
+       {
+               *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];
@@ -687,7 +700,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
                return false;
        }
 
-       VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer);
+       VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer, samples);
        visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib);
        if (!visinfo)
        {
@@ -842,6 +855,12 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
        gl_platform = "GLX";
        gl_platformextensions = qglXQueryExtensionsString(vidx11_display, vidx11_screen);
 
+       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)