]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_agl.c
implemented vid_samples cvar (antialiasing samples per pixel)
[xonotic/darkplaces.git] / vid_agl.c
index 944f955901113b829bcec5e693f98f7dd3240f41..2cf7194bc1edc202d9a5b6677575774c0713d497 100644 (file)
--- a/vid_agl.c
+++ b/vid_agl.c
@@ -29,8 +29,8 @@
 #include <IOKit/hidsystem/IOHIDLib.h>
 #include <IOKit/hidsystem/IOHIDParameter.h>
 #include <IOKit/hidsystem/event_status_driver.h>
-#include "vid_agl_mackeys.h" // this is SDL/src/video/maccommon/SDL_mackeys.h
 #include "quakedef.h"
+#include "vid_agl_mackeys.h" // this is SDL/src/video/maccommon/SDL_mackeys.h
 
 #ifndef kCGLCEMPEngine
 #define kCGLCEMPEngine 313
@@ -60,6 +60,7 @@ CGLContextObj (*qCGLGetCurrentContext) (void);
 static qboolean multithreadedgl;
 static qboolean mouse_avail = true;
 static qboolean vid_usingmouse = false;
+static qboolean vid_usingnoaccel = false;
 static float mouse_x, mouse_y;
 
 static qboolean vid_isfullscreen = false;
@@ -109,6 +110,8 @@ static void IN_Activate( qboolean grab )
 {
        if (grab)
        {
+               if(vid_usingmouse && (vid_usingnoaccel != !!apple_mouse_noaccel.integer))
+                       IN_Activate(false); // ungrab first!
                if (!vid_usingmouse && mouse_avail && window)
                {
                        Rect winBounds;
@@ -158,6 +161,7 @@ static void IN_Activate( qboolean grab )
 
                        mouse_x = mouse_y = 0;
                        vid_usingmouse = true;
+                       vid_usingnoaccel = !!apple_mouse_noaccel.integer;
                }
        }
        else
@@ -495,7 +499,7 @@ static void VID_ProcessPendingAsyncEvents (void)
                Sys_Quit(0);
 }
 
-static void VID_BuildAGLAttrib(GLint *attrib, qboolean stencil, qboolean fullscreen, qboolean stereobuffer)
+static void VID_BuildAGLAttrib(GLint *attrib, qboolean stencil, qboolean fullscreen, qboolean stereobuffer, int samples)
 {
        *attrib++ = AGL_RGBA;
        *attrib++ = AGL_RED_SIZE;*attrib++ = 1;
@@ -514,10 +518,22 @@ static void VID_BuildAGLAttrib(GLint *attrib, qboolean stencil, qboolean fullscr
                *attrib++ = AGL_FULLSCREEN;
        if (stereobuffer)
                *attrib++ = AGL_STEREO;
+#ifdef AGL_SAMPLE_BUFFERS_ARB
+#ifdef AGL_SAMPLES_ARB
+       if (samples > 1)
+       {
+               *attrib++ = AGL_SAMPLE_BUFFERS_ARB;
+               *attrib++ = 1;
+               *attrib++ = AGL_SAMPLES_ARB;
+               *attrib++ = samples;
+       }
+#endif
+#endif
+
        *attrib++ = AGL_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)
 {
     const EventTypeSpec winEvents[] =
        {
@@ -588,7 +604,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
                                                           GetEventTypeCount(winEvents), winEvents, window, NULL);
 
        // Create the desired attribute list
-       VID_BuildAGLAttrib(attributes, bpp == 32, fullscreen, stereobuffer);
+       VID_BuildAGLAttrib(attributes, bpp == 32, fullscreen, stereobuffer, samples);
 
        if (!fullscreen)
        {
@@ -694,6 +710,12 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
        gl_platform = "AGL";
        gl_videosyncavailable = true;
 
+       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);
+
        multithreadedgl = false;
        vid_isfullscreen = fullscreen;
        vid_usingmouse = false;