diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 126593d19..7f40973a2 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -5977,7 +5977,8 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm) else if (!Bstrcasecmp(parm->name, "r_swapinterval")) { if (showval) { OSD_Printf("r_swapinterval is %d\n", vsync); } - else vsync = (val != 0); +// else vsync = (val != 0); + else setvsync(val != 0); return OSDCMD_OK; } #endif diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index 9ec24b7be..9f7105773 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -897,6 +897,7 @@ int setvideomode(int x, int y, int c, int fs) { int regrab = 0; static int warnonce = 0; + static int ovsync = 1; if ((fs == fullscreen) && (x == xres) && (y == yres) && (c == bpp) && !videomodereset) @@ -956,6 +957,7 @@ int setvideomode(int x, int y, int c, int fs) { SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 }, { SDL_GL_MULTISAMPLESAMPLES, glmultisample }, { SDL_GL_STENCIL_SIZE, 1 }, + { SDL_GL_SWAP_CONTROL, vsync }, }; if (nogl) return -1; @@ -977,8 +979,20 @@ int setvideomode(int x, int y, int c, int fs) SDL_GL_SetAttribute(attributes[i].attr, j); } - SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, vsync); + /* HACK: changing SDL GL attribs only works before surface creation, + so we have to create a new surface in a different format first + to force the surface we WANT to be recreated instead of reused. */ + if (vsync != ovsync) + { + if (sdl_surface) + { + SDL_FreeSurface(sdl_surface); + sdl_surface = SDL_SetVideoMode(x, y, 8, SURFACE_FLAGS | ((fs&1)?SDL_FULLSCREEN:0)); + SDL_FreeSurface(sdl_surface); + } + ovsync = vsync; + } sdl_surface = SDL_SetVideoMode(x, y, c, SDL_OPENGL | ((fs&1)?SDL_FULLSCREEN:0)); if (!sdl_surface) { diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index 46a9ab357..f56913942 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -2120,6 +2120,7 @@ int setvideomode(int x, int y, int c, int fs) for (i=0;i8); return 0; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 3215d66fa..582574f4a 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -2441,7 +2441,7 @@ cheat_for_port_credits: "Use models", "Blend model animations", "-", - "Enable VSync", + "Use VSync", NULL };