Ticket #523: SDLGLSWAPCONTROLWIN.patch
File SDLGLSWAPCONTROLWIN.patch, 1.3 KB (added by , 14 years ago) |
---|
-
wsdl.cpp
261 261 262 262 static int depth_bits = 24; // depth buffer size; set via SDL_GL_SetAttribute 263 263 264 typedef BOOL (APIENTRY *PFNWGLEXTSWAPCONTROLPROC)( int ); 265 static int vSyncValue = 1; 266 264 267 // check if resolution needs to be changed 265 268 static bool video_NeedsChange(int w, int h, int cur_w, int cur_h, bool fullscreen) 266 269 { … … 279 282 return false; 280 283 } 281 284 285 void SetVSyncValue() { 282 286 287 char* e = (char*)glGetString(GL_EXTENSIONS); 288 289 if(!e) 290 return; 291 292 if (!strstr(e, "WGL_EXT_swap_control")) 293 return; 294 295 PFNWGLEXTSWAPCONTROLPROC wglSwapEXT = (PFNWGLEXTSWAPCONTROLPROC) wglGetProcAddress("wglSwapIntervalEXT"); 296 297 if (!wglSwapEXT) 298 return; 299 300 wglSwapEXT(vSyncValue); 301 } 302 303 283 304 int SDL_GL_SetAttribute(SDL_GLattr attr, int value) 284 305 { 285 306 if(attr == SDL_GL_DEPTH_SIZE) 286 307 depth_bits = value; 287 308 309 if (attr == SDL_GL_SWAP_CONTROL) { 310 vSyncValue = value; 311 } 312 288 313 return 0; 289 314 } 290 315 … … 373 398 374 399 if(!wglMakeCurrent(g_hDC, hGLRC)) 375 400 return 0; 401 402 // We should not have to call this here but since our code is not really friendly 403 // this will have to do!. 404 SetVSyncValue(); 376 405 } 377 406 else // update the existing window 378 407 {