comparison src/video/wincommon/SDL_wingl.c @ 1703:a51dfda0ff33 SDL-1.3

Merged SDL_GL_SWAP_CONTROL fix from SDL 1.2
author Sam Lantinga <slouken@libsdl.org>
date Sat, 24 Jun 2006 02:48:55 +0000
parents 4da1ee79c9af
children
comparison
equal deleted inserted replaced
1702:a7ad7081b977 1703:a51dfda0ff33
148 this->gl_data->WGL_ARB_pixel_format = 0; 148 this->gl_data->WGL_ARB_pixel_format = 0;
149 if (ExtensionSupported("WGL_ARB_pixel_format", extensions)) { 149 if (ExtensionSupported("WGL_ARB_pixel_format", extensions)) {
150 this->gl_data->wglChoosePixelFormatARB = (BOOL(WINAPI *) 150 this->gl_data->wglChoosePixelFormatARB = (BOOL(WINAPI *)
151 (HDC, const int *, 151 (HDC, const int *,
152 const FLOAT *, UINT, int *, 152 const FLOAT *, UINT, int *,
153 UINT *)) this->gl_data-> 153 UINT *))
154 wglGetProcAddress("wglChoosePixelFormatARB"); 154 this->gl_data->wglGetProcAddress("wglChoosePixelFormatARB");
155 this->gl_data->wglGetPixelFormatAttribivARB = 155 this->gl_data->wglGetPixelFormatAttribivARB =
156 (BOOL(WINAPI *) (HDC, int, int, UINT, const int *, int *)) 156 (BOOL(WINAPI *) (HDC, int, int, UINT, const int *, int *))
157 this->gl_data->wglGetProcAddress("wglGetPixelFormatAttribivARB"); 157 this->gl_data->wglGetProcAddress("wglGetPixelFormatAttribivARB");
158 158
159 if ((this->gl_data->wglChoosePixelFormatARB != NULL) && 159 if ((this->gl_data->wglChoosePixelFormatARB != NULL) &&
355 wglext = (const char *) glGetStringFunc(GL_EXTENSIONS); 355 wglext = (const char *) glGetStringFunc(GL_EXTENSIONS);
356 } else { 356 } else {
357 /* Uh oh, something is seriously wrong here... */ 357 /* Uh oh, something is seriously wrong here... */
358 wglext = NULL; 358 wglext = NULL;
359 } 359 }
360 if (!wglext || !SDL_strstr(wglext, "WGL_EXT_swap_control")) { 360 if (wglext && SDL_strstr(wglext, "WGL_EXT_swap_control")) {
361 this->gl_data->wglSwapIntervalEXT =
362 WIN_GL_GetProcAddress(this, "wglSwapIntervalEXT");
363 this->gl_data->wglGetSwapIntervalEXT =
364 WIN_GL_GetProcAddress(this, "wglGetSwapIntervalEXT");
365 } else {
361 this->gl_data->wglSwapIntervalEXT = NULL; 366 this->gl_data->wglSwapIntervalEXT = NULL;
362 this->gl_data->wglGetSwapIntervalEXT = NULL; 367 this->gl_data->wglGetSwapIntervalEXT = NULL;
363 } 368 }
364 if (this->gl_config.swap_control >= 0) { 369 if (this->gl_config.swap_control >= 0) {
365 if (this->gl_data->wglSwapIntervalEXT) { 370 if (this->gl_data->wglSwapIntervalEXT) {
468 case SDL_GL_MULTISAMPLESAMPLES: 473 case SDL_GL_MULTISAMPLESAMPLES:
469 wgl_attrib = WGL_SAMPLES_ARB; 474 wgl_attrib = WGL_SAMPLES_ARB;
470 break; 475 break;
471 case SDL_GL_ACCELERATED_VISUAL: 476 case SDL_GL_ACCELERATED_VISUAL:
472 wgl_attrib = WGL_ACCELERATION_ARB; 477 wgl_attrib = WGL_ACCELERATION_ARB;
473 this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, 478 this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format,
474 pixel_format, 0, 479 0, 1, &wgl_attrib,
475 1, &wgl_attrib,
476 value); 480 value);
477 if (*value == WGL_NO_ACCELERATION_ARB) { 481 if (*value == WGL_NO_ACCELERATION_ARB) {
478 *value = SDL_FALSE; 482 *value = SDL_FALSE;
479 } else { 483 } else {
480 *value = SDL_TRUE; 484 *value = SDL_TRUE;
481 } 485 }
482 return 0; 486 return 0;
483 break; 487 break;
484 case SDL_GL_SWAP_CONTROL: 488 case SDL_GL_SWAP_CONTROL:
485 if (this->gl_data->wglGetSwapIntervalEXT) { 489 if (this->gl_data->wglGetSwapIntervalEXT) {
486 return this->gl_data->wglGetSwapIntervalEXT(); 490 *value = this->gl_data->wglGetSwapIntervalEXT();
491 return 0;
487 } else { 492 } else {
488 return -1; 493 return -1;
489 } 494 }
495 break;
490 default: 496 default:
491 return (-1); 497 return (-1);
492 } 498 }
493 this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 499 this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 0,
494 0, 1, &wgl_attrib, value); 500 1, &wgl_attrib, value);
495 501
496 return 0; 502 return 0;
497 } 503 }
498 504
499 retval = 0; 505 retval = 0;
548 case SDL_GL_MULTISAMPLEBUFFERS: 554 case SDL_GL_MULTISAMPLEBUFFERS:
549 *value = 0; 555 *value = 0;
550 break; 556 break;
551 case SDL_GL_MULTISAMPLESAMPLES: 557 case SDL_GL_MULTISAMPLESAMPLES:
552 *value = 1; 558 *value = 1;
559 break;
560 case SDL_GL_SWAP_CONTROL:
561 if (this->gl_data->wglGetSwapIntervalEXT) {
562 *value = this->gl_data->wglGetSwapIntervalEXT();
563 return 0;
564 } else {
565 return -1;
566 }
553 break; 567 break;
554 default: 568 default:
555 retval = -1; 569 retval = -1;
556 break; 570 break;
557 } 571 }
651 } 665 }
652 return func; 666 return func;
653 } 667 }
654 668
655 #endif /* SDL_VIDEO_OPENGL */ 669 #endif /* SDL_VIDEO_OPENGL */
670
656 /* vi: set ts=4 sw=4 expandtab: */ 671 /* vi: set ts=4 sw=4 expandtab: */