diff --git a/src/engine/gl_main.c b/src/engine/gl_main.c index e27f7580..b2298267 100644 --- a/src/engine/gl_main.c +++ b/src/engine/gl_main.c @@ -71,6 +71,7 @@ CVAR_EXTERNAL(v_vsync); CVAR_EXTERNAL(r_filter); CVAR_EXTERNAL(r_texturecombiner); CVAR_EXTERNAL(r_anisotropic); +CVAR_EXTERNAL(r_multisample); CVAR_EXTERNAL(st_flashoverlay); CVAR_EXTERNAL(r_colorscale); diff --git a/src/engine/i_video.c b/src/engine/i_video.c index 119b0a5a..5138157d 100644 --- a/src/engine/i_video.c +++ b/src/engine/i_video.c @@ -59,6 +59,8 @@ CVAR(v_height, 480); CVAR(v_windowed, 1); CVAR(v_windowborderless, 0); +CVAR_EXTERNAL(r_multisample); + SDL_Surface* screen; int video_width; int video_height; @@ -128,8 +130,15 @@ void I_InitScreen(void) { SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE, 0); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); + + if (r_multisample.value > 0) + { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); + } else { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); + } flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_ALLOW_HIGHDPI; diff --git a/src/engine/m_menu.c b/src/engine/m_menu.c index 11488f63..4569ddb6 100644 --- a/src/engine/m_menu.c +++ b/src/engine/m_menu.c @@ -1744,6 +1744,7 @@ void M_ChangeWindowed(int choice); void M_ChangeRatio(int choice); void M_ChangeResolution(int choice); void M_ChangeAnisotropic(int choice); +void M_ChangeAntiAliasing(int choice); void M_ChangeInterpolateFrames(int choice); void M_ChangeVerticalSynchronisation(int choice); void M_ChangeAccessibility(int choice); @@ -1757,6 +1758,7 @@ CVAR_EXTERNAL(i_gamma); CVAR_EXTERNAL(i_brightness); CVAR_EXTERNAL(r_filter); CVAR_EXTERNAL(r_anisotropic); +CVAR_EXTERNAL(r_multisample); CVAR_EXTERNAL(i_interpolateframes); CVAR_EXTERNAL(v_vsync); CVAR_EXTERNAL(v_accessibility); @@ -1768,6 +1770,7 @@ enum { video_empty2, filter, anisotropic, + multisample, windowed, ratio, resolution, @@ -1787,6 +1790,7 @@ menuitem_t VideoMenu[] = { {-1,"",0}, {2,"Filter:",M_ChangeFilter, 'f'}, {2,"Anisotropy:",M_ChangeAnisotropic, 'a'}, + {2,"Antialiasing:",M_ChangeAntiAliasing, 't'}, {2,"Windowed:",M_ChangeWindowed, 'w'}, {2,"Aspect Ratio:",M_ChangeRatio, 'a'}, {2,"Resolution:",M_ChangeResolution, 'r'}, @@ -1804,6 +1808,7 @@ char* VideoHints[video_end] = { "adjust screen gamma", NULL, "toggle texture filtering", + "toggle antialiasing", "toggle blur reduction on textures", "toggle windowed mode", "select aspect ratio", @@ -1819,6 +1824,7 @@ menudefault_t VideoDefault[] = { { &i_gamma, 0 }, { &r_filter, 0 }, { &r_anisotropic, 1 }, + { &r_multisample, 1 }, { &v_windowed, 0 }, { &i_interpolateframes, 1 }, { &v_vsync, 1 }, @@ -2019,6 +2025,7 @@ void M_DrawVideo(void) { static const char* ratioName[5] = { "4 : 3", "16 : 9", "16 : 10", "5 : 4", "21 : 09"}; static const char* frametype[2] = { "Off", "On" }; static const char* vsynctype[2] = { "Off", "Adaptive" }; + static const char* multisampletype[2] = { "4", "Off"}; char res[16]; int y; @@ -2046,6 +2053,7 @@ void M_DrawVideo(void) { DRAWVIDEOITEM2(filter, r_filter.value, filterType); DRAWVIDEOITEM2(anisotropic, r_anisotropic.value, msgNames); + DRAWVIDEOITEM2(multisample, r_multisample.value, multisampletype); DRAWVIDEOITEM2(windowed, v_windowed.value, msgNames); DRAWVIDEOITEM2(ratio, m_aspectRatio, ratioName); @@ -2139,6 +2147,10 @@ void M_ChangeAnisotropic(int choice) { M_SetOptionValue(choice, 0, 1, 1, &r_anisotropic); } +void M_ChangeAntiAliasing(int choice) { + M_SetOptionValue(choice, 0, 1, 1, &r_multisample); +} + void M_ChangeWindowed(int choice) { M_SetOptionValue(choice, 0, 1, 1, &v_windowed); } diff --git a/src/engine/r_main.c b/src/engine/r_main.c index 7192ed88..731e4f20 100644 --- a/src/engine/r_main.c +++ b/src/engine/r_main.c @@ -103,6 +103,7 @@ CVAR_CMD(r_anisotropic, 1) { GL_SetTextureFilter(); } +CVAR(r_multisample, 1); CVAR_EXTERNAL(r_texturecombiner); CVAR_EXTERNAL(i_interpolateframes); CVAR_EXTERNAL(p_usecontext); @@ -796,6 +797,7 @@ void R_RegisterCvars(void) { CON_CvarRegister(&r_fog); CON_CvarRegister(&r_filter); CON_CvarRegister(&r_anisotropic); + CON_CvarRegister(&r_multisample); CON_CvarRegister(&r_wipe); CON_CvarRegister(&r_drawmobjbox); CON_CvarRegister(&r_rendersprites);