X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=vid_shared.c;h=873d43285c39bf3cca2bb5c64e7f0a2f3dd5274a;hb=57d7496c097df506f385c4a301173e7576c987c7;hp=24a1509425533143776b4f3ca0a18910be82c375;hpb=d6070bce95a76039af1a5073b0fed22efab34bae;p=xonotic%2Fdarkplaces.git diff --git a/vid_shared.c b/vid_shared.c index 24a15094..873d4328 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -164,7 +164,6 @@ cvar_t vid_width = {CVAR_SAVE, "vid_width", "640", "resolution"}; cvar_t vid_height = {CVAR_SAVE, "vid_height", "480", "resolution"}; cvar_t vid_bitsperpixel = {CVAR_SAVE, "vid_bitsperpixel", "32", "how many bits per pixel to render at (32 or 16, 32 is recommended)"}; cvar_t vid_samples = {CVAR_SAVE, "vid_samples", "1", "how many anti-aliasing samples per pixel to request from the graphics driver (4 is recommended, 1 is faster)"}; -cvar_t vid_multisampling = {CVAR_SAVE, "vid_multisampling", "0", "Make use of GL_AGB_MULTISAMPLING for advaced anti-aliasing techniques such as Alpha-To-Coverage, not yet finished"}; cvar_t vid_refreshrate = {CVAR_SAVE, "vid_refreshrate", "60", "refresh rate to use, in hz (higher values flicker less, if supported by your monitor)"}; cvar_t vid_userefreshrate = {CVAR_SAVE, "vid_userefreshrate", "0", "set this to 1 to make vid_refreshrate used, or to 0 to let the engine choose a sane default"}; cvar_t vid_stereobuffer = {CVAR_SAVE, "vid_stereobuffer", "0", "enables 'quad-buffered' stereo rendering for stereo shutterglasses, HMD (head mounted display) devices, or polarized stereo LCDs, if supported by your drivers"}; @@ -955,7 +954,7 @@ void VID_CheckExtensions(void) { if (!GL_CheckExtension("glbase", opengl110funcs, NULL, false)) Sys_Error("OpenGL 1.1.0 functions not found"); - vid.support.gl20shaders = GL_CheckExtension("GL_ARB_fragment_shader", gl20shaderfuncs, "-noshaders", true); + vid.support.gl20shaders = GL_CheckExtension("2.0", gl20shaderfuncs, "-noshaders", true); CHECKGLERROR @@ -1007,6 +1006,7 @@ void VID_CheckExtensions(void) vid.support.ext_texture_filter_anisotropic = GL_CheckExtension("GL_EXT_texture_filter_anisotropic", NULL, "-noanisotropy", false); vid.support.ext_texture_srgb = GL_CheckExtension("GL_EXT_texture_sRGB", NULL, "-nosrgb", false); vid.support.arb_multisample = GL_CheckExtension("GL_ARB_multisample", multisamplefuncs, "-nomultisample", false); + vid.allowalphatocoverage = false; // COMMANDLINEOPTION: GL: -noshaders disables use of OpenGL 2.0 shaders (which allow pixel shader effects, can improve per pixel lighting performance and capabilities) // COMMANDLINEOPTION: GL: -noanisotropy disables GL_EXT_texture_filter_anisotropic (allows higher quality texturing) @@ -1082,6 +1082,10 @@ void VID_CheckExtensions(void) vid.sRGBcapable2D = false; vid.sRGBcapable3D = true; vid.useinterleavedarrays = false; + Con_Printf("vid.support.arb_multisample %i\n", vid.support.arb_multisample); + Con_Printf("vid.mode.samples %i\n", vid.mode.samples); + Con_Printf("vid.support.gl20shaders %i\n", vid.support.gl20shaders); + vid.allowalphatocoverage = vid.support.arb_multisample && vid_samples.integer > 1 && vid.support.gl20shaders; } else if (vid.support.arb_texture_env_combine && vid.texunits >= 2 && vid_gl13.integer) { @@ -1106,6 +1110,9 @@ void VID_CheckExtensions(void) vid.sRGBcapable3D = false; vid.useinterleavedarrays = false; } + // enable multisample antialiasing if possible + if (vid_samples.integer > 1 && vid.support.arb_multisample) + qglEnable(GL_MULTISAMPLE_ARB); // VorteX: set other info (maybe place them in VID_InitMode?) Cvar_SetQuick(&gl_info_vendor, gl_vendor); @@ -1193,7 +1200,7 @@ void VID_Shared_BuildJoyState_Begin(vid_joystate_t *joystate) void VID_Shared_BuildJoyState_Finish(vid_joystate_t *joystate) { float f, r; - if (!joy_axiskeyevents.integer || joystate->is360) + if (joystate->is360) return; // emulate key events for thumbstick f = VID_JoyState_GetAxis(joystate, joy_axisforward.integer, 1, joy_axiskeyevents_deadzone.value) * joy_sensitivityforward.value; @@ -1242,7 +1249,7 @@ static int joybuttonkey[MAXJOYBUTTON][2] = { {K_JOY1, K_ENTER}, {K_JOY2, K_ESCAPE}, {K_JOY3, 0}, {K_JOY4, 0}, {K_JOY5, 0}, {K_JOY6, 0}, {K_JOY7, 0}, {K_JOY8, 0}, {K_JOY9, 0}, {K_JOY10, 0}, {K_JOY11, 0}, {K_JOY12, 0}, {K_JOY13, 0}, {K_JOY14, 0}, {K_JOY15, 0}, {K_JOY16, 0}, {K_AUX1, 0}, {K_AUX2, 0}, {K_AUX3, 0}, {K_AUX4, 0}, {K_AUX5, 0}, {K_AUX6, 0}, {K_AUX7, 0}, {K_AUX8, 0}, {K_AUX9, 0}, {K_AUX10, 0}, {K_AUX11, 0}, {K_AUX12, 0}, {K_AUX13, 0}, {K_AUX14, 0}, {K_AUX15, 0}, {K_AUX16, 0}, - {K_UPARROW, K_UPARROW}, {K_DOWNARROW, K_DOWNARROW}, {K_RIGHTARROW, K_RIGHTARROW}, {K_LEFTARROW, K_LEFTARROW}, + {K_JOY_UP, K_UPARROW}, {K_JOY_DOWN, K_DOWNARROW}, {K_JOY_RIGHT, K_RIGHTARROW}, {K_JOY_LEFT, K_LEFTARROW}, }; static int joybuttonkey360[][2] = @@ -1640,7 +1647,6 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&vid_height); Cvar_RegisterVariable(&vid_bitsperpixel); Cvar_RegisterVariable(&vid_samples); - Cvar_RegisterVariable(&vid_multisampling); Cvar_RegisterVariable(&vid_refreshrate); Cvar_RegisterVariable(&vid_userefreshrate); Cvar_RegisterVariable(&vid_stereobuffer); @@ -1715,17 +1721,6 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, float refreshrate, { viddef_mode_t mode; -#if 0 - // LordHavoc: FIXME: VorteX broke vid_restart with this, it is a mystery why it would ever work, commented out - // multisampling should set at least 2 samples - if (vid.support.arb_multisample) - { - GL_MultiSampling(false); - if (vid_multisampling.integer) - samples = max(2, samples); - } -#endif - memset(&mode, 0, sizeof(mode)); mode.fullscreen = fullscreen != 0; mode.width = width; @@ -1764,10 +1759,6 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, float refreshrate, Cvar_SetValueQuick(&vid_refreshrate, vid.mode.refreshrate); Cvar_SetValueQuick(&vid_stereobuffer, vid.mode.stereobuffer); - // activate multisampling - if (vid_multisampling.integer) - GL_MultiSampling(true); - return true; } else