git-svn-id: https://svn.eduke32.com/eduke32@890 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-07-22 21:56:28 +00:00
parent d8ae04d773
commit 8838d469c1
4 changed files with 19 additions and 3 deletions

View file

@ -5977,7 +5977,8 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm)
else if (!Bstrcasecmp(parm->name, "r_swapinterval")) else if (!Bstrcasecmp(parm->name, "r_swapinterval"))
{ {
if (showval) { OSD_Printf("r_swapinterval is %d\n", vsync); } 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; return OSDCMD_OK;
} }
#endif #endif

View file

@ -897,6 +897,7 @@ int setvideomode(int x, int y, int c, int fs)
{ {
int regrab = 0; int regrab = 0;
static int warnonce = 0; static int warnonce = 0;
static int ovsync = 1;
if ((fs == fullscreen) && (x == xres) && (y == yres) && (c == bpp) && if ((fs == fullscreen) && (x == xres) && (y == yres) && (c == bpp) &&
!videomodereset) !videomodereset)
@ -956,6 +957,7 @@ int setvideomode(int x, int y, int c, int fs)
{ SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 }, { SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 },
{ SDL_GL_MULTISAMPLESAMPLES, glmultisample }, { SDL_GL_MULTISAMPLESAMPLES, glmultisample },
{ SDL_GL_STENCIL_SIZE, 1 }, { SDL_GL_STENCIL_SIZE, 1 },
{ SDL_GL_SWAP_CONTROL, vsync },
}; };
if (nogl) return -1; 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(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)); sdl_surface = SDL_SetVideoMode(x, y, c, SDL_OPENGL | ((fs&1)?SDL_FULLSCREEN:0));
if (!sdl_surface) if (!sdl_surface)
{ {

View file

@ -2120,6 +2120,7 @@ int setvideomode(int x, int y, int c, int fs)
for (i=0;i<NUM_INPUTS;i++) if (inp[i]) AcquireInputDevices(1,i); for (i=0;i<NUM_INPUTS;i++) if (inp[i]) AcquireInputDevices(1,i);
modechange=1; modechange=1;
videomodereset = 0; videomodereset = 0;
OSD_ResizeDisplay(xres,yres);
//baselayer_onvideomodechange(c>8); //baselayer_onvideomodechange(c>8);
return 0; return 0;

View file

@ -2441,7 +2441,7 @@ cheat_for_port_credits:
"Use models", "Use models",
"Blend model animations", "Blend model animations",
"-", "-",
"Enable VSync", "Use VSync",
NULL NULL
}; };