]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
logarithm
[xonotic/darkplaces.git] / vid_shared.c
index 7376fee86b6a83965ae87e5efa3ded647bbb97d0..2af2694351df95a99372fa80b571c21224259c77 100644 (file)
@@ -20,6 +20,7 @@ float in_windowmouse_x, in_windowmouse_y;
 int gl_max_texture_size = 0;
 int gl_max_3d_texture_size = 0;
 int gl_max_cube_map_texture_size = 0;
+int gl_max_rectangle_texture_size = 0;
 // GL_ARB_multitexture
 int gl_textureunits = 1;
 // GL_ARB_texture_env_combine or GL_EXT_texture_env_combine
@@ -34,10 +35,16 @@ int gl_stencil = false;
 int gl_texture3d = false;
 // GL_ARB_texture_cubemap
 int gl_texturecubemap = false;
+// GL_ARB_texture_rectangle
+int gl_texturerectangle = false;
 // GL_ARB_texture_non_power_of_two
 int gl_support_arb_texture_non_power_of_two = false;
 // GL_ARB_texture_env_dot3
 int gl_dot3arb = false;
+// GL_ARB_depth_texture
+int gl_depthtexture = false;
+// GL_ARB_shadow
+int gl_support_arb_shadow = false;
 // GL_SGIS_texture_edge_clamp
 int gl_support_clamptoedge = false;
 // GL_EXT_texture_filter_anisotropic
@@ -67,6 +74,10 @@ int gl_support_ext_framebuffer_object = false;
 int gl_support_texture_compression = false;
 //GL_ARB_occlusion_query
 int gl_support_arb_occlusion_query = false;
+//GL_AMD_texture_texture4
+int gl_support_amd_texture_texture4 = false;
+//GL_ARB_texture_gather
+int gl_support_arb_texture_gather = false;
 
 // LordHavoc: if window is hidden, don't update screen
 qboolean vid_hidden = true;
@@ -97,7 +108,7 @@ cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1", "whether to use the mouse in wi
 cvar_t vid_grabkeyboard = {CVAR_SAVE, "vid_grabkeyboard", "0", "whether to grab the keyboard when mouse is active (prevents use of volume control keys, music player keys, etc on some keyboards)"};
 cvar_t vid_minwidth = {0, "vid_minwidth", "0", "minimum vid_width that is acceptable (to be set in default.cfg in mods)"};
 cvar_t vid_minheight = {0, "vid_minheight", "0", "minimum vid_height that is acceptable (to be set in default.cfg in mods)"};
-cvar_t gl_combine = {0, "gl_combine", "1", "faster rendering by using GL_ARB_texture_env_combine extension (part of OpenGL 1.3 and above)"};
+cvar_t gl_combine = {0, "gl_combine", "1", "enables faster rendering using GL_ARB_texture_env_combine extension (part of OpenGL 1.3 and above)"};
 cvar_t gl_finish = {0, "gl_finish", "0", "make the cpu wait for the graphics processor at the end of each rendered frame (can help with strange input or video lag problems on some machines)"};
 
 cvar_t vid_stick_mouse = {CVAR_SAVE, "vid_stick_mouse", "0", "have the mouse stuck in the center of the screen" };
@@ -823,8 +834,11 @@ void VID_CheckExtensions(void)
        gl_supportslockarrays = false;
        gl_texture3d = false;
        gl_texturecubemap = false;
+       gl_texturerectangle = false;
        gl_support_arb_texture_non_power_of_two = false;
        gl_dot3arb = false;
+       gl_depthtexture = false;
+       gl_support_arb_shadow = false;
        gl_support_clamptoedge = false;
        gl_support_anisotropy = false;
        gl_max_anisotropy = 1;
@@ -840,6 +854,8 @@ void VID_CheckExtensions(void)
        gl_support_ext_framebuffer_object = false;
        gl_support_texture_compression = false;
        gl_support_arb_occlusion_query = false;
+       gl_support_amd_texture_texture4 = false;
+       gl_support_arb_texture_gather = false;
 
        if (!GL_CheckExtension("1.1", opengl110funcs, NULL, false))
                Sys_Error("OpenGL 1.1.0 functions not found");
@@ -877,6 +893,14 @@ 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);
+// COMMANDLINEOPTION: GL: -norectangle disables GL_ARB_texture_rectangle (required for bumpmapping)
+       if ((gl_texturerectangle = GL_CheckExtension("GL_ARB_texture_rectangle", NULL, "-norectangle", false)))
+               qglGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB, &gl_max_rectangle_texture_size);
+// COMMANDLINEOPTION: GL: -nodepthtexture disables use of GL_ARB_depth_texture (required for shadowmapping)
+       gl_depthtexture = GL_CheckExtension("GL_ARB_depth_texture", NULL, "-nodepthtexture", false);
+// COMMANDLINEOPTION: GL: -noshadow disables use of GL_ARB_shadow (required for hardware shadowmap filtering)
+       gl_support_arb_shadow = GL_CheckExtension("GL_ARB_shadow", NULL, "-noshadow", false);
+
 // 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)
@@ -931,6 +955,11 @@ void VID_CheckExtensions(void)
 
 // COMMANDLINEOPTION: GL: -noocclusionquery disables GL_ARB_occlusion_query (which allows coronas to fade according to visibility, and potentially used for rendering optimizations)
        gl_support_arb_occlusion_query = GL_CheckExtension("GL_ARB_occlusion_query", occlusionqueryfuncs, "-noocclusionquery", false);
+
+// COMMANDLINEOPTION: GL: -notexture4 disables GL_AMD_texture_texture4 (which provides fetch4 sampling)
+    gl_support_amd_texture_texture4 = GL_CheckExtension("GL_AMD_texture_texture4", NULL, "-notexture4", false);
+// COMMANDLINEOPTION: GL: -notexturegather disables GL_ARB_texture_gather (which provides fetch4 sampling)
+    gl_support_arb_texture_gather = GL_CheckExtension("GL_ARB_texture_gather", NULL, "-notexturegather", false);
 }
 
 void Force_CenterView_f (void)
@@ -1193,14 +1222,14 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, int refreshrate, in
        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))
        {
-               vid.fullscreen = fullscreen;
+               vid.fullscreen = fullscreen != 0;
                vid.width = width;
                vid.height = height;
                vid.bitsperpixel = bpp;
                vid.samples = samples;
                vid.refreshrate = refreshrate;
-               vid.stereobuffer = stereobuffer;
-               vid.userefreshrate = vid_userefreshrate.integer;
+               vid.stereobuffer = stereobuffer != 0;
+               vid.userefreshrate = vid_userefreshrate.integer != 0;
                Cvar_SetValueQuick(&vid_fullscreen, fullscreen);
                Cvar_SetValueQuick(&vid_width, width);
                Cvar_SetValueQuick(&vid_height, height);