]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
more fullscreen cleanup
[xonotic/darkplaces.git] / vid_shared.c
index aaea23c0a45c746fb9bf15e1b9e3a3e8edcbb7b5..5edba6706b02e1faf57d244bc7ce4126eebae742 100644 (file)
@@ -14,6 +14,7 @@ qboolean in_client_mouse = true;
 
 // AK where should it be placed ?
 float in_mouse_x, in_mouse_y;
+float in_windowmouse_x, in_windowmouse_y;
 
 // value of GL_MAX_TEXTURE_<various>_SIZE
 int gl_max_texture_size = 0;
@@ -397,29 +398,27 @@ int GL_CheckExtension(const char *name, const dllfunction_t *funcs, const char *
                return false;
        }
 
-       if (strstr(gl_extensions, name) || strstr(gl_platformextensions, name) || (strncmp(name, "GL_", 3) && strncmp(name, "WGL_", 4) && strncmp(name, "GLX_", 4) && strncmp(name, "AGL_", 4)))
+       if ((name[2] == '_' || name[3] == '_') && !strstr(gl_extensions ? gl_extensions : "", name) && !strstr(gl_platformextensions ? gl_platformextensions : "", name))
        {
-               for (func = funcs;func && func->name != NULL;func++)
+               Con_DPrint("not detected\n");
+               return false;
+       }
+
+       for (func = funcs;func && func->name != NULL;func++)
+       {
+               // functions are cleared before all the extensions are evaluated
+               if (!(*func->funcvariable = (void *) GL_GetProcAddress(func->name)))
                {
-                       // functions are cleared before all the extensions are evaluated
-                       if (!(*func->funcvariable = (void *) GL_GetProcAddress(func->name)))
-                       {
-                               if (!silent)
-                                       Con_DPrintf("OpenGL extension \"%s\" is missing function \"%s\" - broken driver!\n", name, func->name);
-                               failed = true;
-                       }
+                       if (!silent)
+                               Con_DPrintf("OpenGL extension \"%s\" is missing function \"%s\" - broken driver!\n", name, func->name);
+                       failed = true;
                }
-               // delay the return so it prints all missing functions
-               if (failed)
-                       return false;
-               Con_DPrint("enabled\n");
-               return true;
        }
-       else
-       {
-               Con_DPrint("not detected\n");
+       // delay the return so it prints all missing functions
+       if (failed)
                return false;
-       }
+       Con_DPrint("enabled\n");
+       return true;
 }
 
 static dllfunction_t opengl110funcs[] =
@@ -772,9 +771,12 @@ void VID_CheckExtensions(void)
 // COMMANDLINEOPTION: GL: -nocubemap disables GL_ARB_texture_cube_map (required for bumpmapping)
        if ((gl_texturecubemap = GL_CheckExtension("GL_ARB_texture_cube_map", NULL, "-nocubemap", false)))
                qglGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, &gl_max_cube_map_texture_size);
+#ifndef __APPLE__
        // TODO: blacklist this extension on Radeon X1600-X1950 hardware (they support it only with certain filtering/repeat modes)
+       // LordHavoc: this is blocked on Mac OS X because the drivers claim support but often can't accelerate it or crash when used.
 // COMMANDLINEOPTION: GL: -notexturenonpoweroftwo disables GL_ARB_texture_non_power_of_two (which saves video memory if it is supported, but crashes on some buggy drivers)
        gl_support_arb_texture_non_power_of_two = GL_CheckExtension("GL_ARB_texture_non_power_of_two", NULL, "-notexturenonpoweroftwo", false);
+#endif
 // COMMANDLINEOPTION: GL: -notexturecompression disables GL_ARB_texture_compression (which saves video memory if it is supported, but can also degrade image quality, see gl_texturecompression cvar documentation for more information)
        gl_support_texture_compression = GL_CheckExtension("GL_ARB_texture_compression", texturecompressionfuncs, "-notexturecompression", false);
 // COMMANDLINEOPTION: GL: -nocva disables GL_EXT_compiled_vertex_array (renders faster)
@@ -1067,9 +1069,11 @@ void VID_Shared_Init(void)
 
 int VID_Mode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer, int samples)
 {
+       int requestedWidth = width;
+       int requestedHeight = height;
        cl_ignoremousemoves = 2;
        Con_Printf("Initializing Video Mode: %s %dx%dx%dx%dhz%s%s\n", fullscreen ? "fullscreen" : "window", width, height, bpp, refreshrate, stereobuffer ? " stereo" : "", samples > 1 ? va(" (%ix AA)", samples) : "");
-       if (VID_InitMode(fullscreen, width, height, bpp, vid_userefreshrate.integer ? max(1, refreshrate) : 0, stereobuffer, samples))
+       if (VID_InitMode(fullscreen, &width, &height, bpp, vid_userefreshrate.integer ? max(1, refreshrate) : 0, stereobuffer, samples))
        {
                vid.fullscreen = fullscreen;
                vid.width = width;
@@ -1087,6 +1091,10 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, int refreshrate, in
                if(vid_userefreshrate.integer)
                        Cvar_SetValueQuick(&vid_refreshrate, refreshrate);
                Cvar_SetValueQuick(&vid_stereobuffer, stereobuffer);
+
+               if(width != requestedWidth || height != requestedHeight)
+                       Con_Printf("Chose a similar video mode %dx%d instead of the requested mode %dx%d\n", width, height, requestedWidth, requestedHeight);
+
                return true;
        }
        else