comparison src/video/wincommon/SDL_wingl.c @ 1880:9d940db55a91

Fixed bug #260 Fixed SDL_GL_SWAP_CONTROL on Windows, and the query on Linux
author Sam Lantinga <slouken@libsdl.org>
date Sat, 24 Jun 2006 01:59:43 +0000
parents 290b5baf2fca
children c121d94672cb 5c6e937518c6
comparison
equal deleted inserted replaced
1879:cb232e63552c 1880:9d940db55a91
344 wglext = (const char *)glGetStringFunc(GL_EXTENSIONS); 344 wglext = (const char *)glGetStringFunc(GL_EXTENSIONS);
345 } else { 345 } else {
346 /* Uh oh, something is seriously wrong here... */ 346 /* Uh oh, something is seriously wrong here... */
347 wglext = NULL; 347 wglext = NULL;
348 } 348 }
349 if ( !wglext || !SDL_strstr(wglext, "WGL_EXT_swap_control") ) { 349 if ( wglext && SDL_strstr(wglext, "WGL_EXT_swap_control") ) {
350 this->gl_data->wglSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglSwapIntervalEXT");
351 this->gl_data->wglGetSwapIntervalEXT = WIN_GL_GetProcAddress(this, "wglGetSwapIntervalEXT");
352 } else {
350 this->gl_data->wglSwapIntervalEXT = NULL; 353 this->gl_data->wglSwapIntervalEXT = NULL;
351 this->gl_data->wglGetSwapIntervalEXT = NULL; 354 this->gl_data->wglGetSwapIntervalEXT = NULL;
352 } 355 }
353 if ( this->gl_config.swap_control >= 0 ) { 356 if ( this->gl_config.swap_control >= 0 ) {
354 if ( this->gl_data->wglSwapIntervalEXT ) { 357 if ( this->gl_data->wglSwapIntervalEXT ) {
464 } 467 }
465 return 0; 468 return 0;
466 break; 469 break;
467 case SDL_GL_SWAP_CONTROL: 470 case SDL_GL_SWAP_CONTROL:
468 if ( this->gl_data->wglGetSwapIntervalEXT ) { 471 if ( this->gl_data->wglGetSwapIntervalEXT ) {
469 return this->gl_data->wglGetSwapIntervalEXT(); 472 *value = this->gl_data->wglGetSwapIntervalEXT();
473 return 0;
470 } else { 474 } else {
471 return -1; 475 return -1;
472 } 476 }
477 break;
473 default: 478 default:
474 return(-1); 479 return(-1);
475 } 480 }
476 this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 0, 1, &wgl_attrib, value); 481 this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 0, 1, &wgl_attrib, value);
477 482
530 case SDL_GL_MULTISAMPLEBUFFERS: 535 case SDL_GL_MULTISAMPLEBUFFERS:
531 *value = 0; 536 *value = 0;
532 break; 537 break;
533 case SDL_GL_MULTISAMPLESAMPLES: 538 case SDL_GL_MULTISAMPLESAMPLES:
534 *value = 1; 539 *value = 1;
540 break;
541 case SDL_GL_SWAP_CONTROL:
542 if ( this->gl_data->wglGetSwapIntervalEXT ) {
543 *value = this->gl_data->wglGetSwapIntervalEXT();
544 return 0;
545 } else {
546 return -1;
547 }
535 break; 548 break;
536 default: 549 default:
537 retval = -1; 550 retval = -1;
538 break; 551 break;
539 } 552 }