Mercurial > sdl-ios-xcode
changeset 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 | a7ad7081b977 |
children | 03fb364e3283 |
files | src/video/wincommon/SDL_wingl.c src/video/x11/SDL_x11gl.c test/testgl.c |
diffstat | 3 files changed, 30 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/wincommon/SDL_wingl.c Fri Jun 23 09:01:08 2006 +0000 +++ b/src/video/wincommon/SDL_wingl.c Sat Jun 24 02:48:55 2006 +0000 @@ -150,8 +150,8 @@ this->gl_data->wglChoosePixelFormatARB = (BOOL(WINAPI *) (HDC, const int *, const FLOAT *, UINT, int *, - UINT *)) this->gl_data-> - wglGetProcAddress("wglChoosePixelFormatARB"); + UINT *)) + this->gl_data->wglGetProcAddress("wglChoosePixelFormatARB"); this->gl_data->wglGetPixelFormatAttribivARB = (BOOL(WINAPI *) (HDC, int, int, UINT, const int *, int *)) this->gl_data->wglGetProcAddress("wglGetPixelFormatAttribivARB"); @@ -357,7 +357,12 @@ /* Uh oh, something is seriously wrong here... */ wglext = NULL; } - if (!wglext || !SDL_strstr(wglext, "WGL_EXT_swap_control")) { + if (wglext && SDL_strstr(wglext, "WGL_EXT_swap_control")) { + this->gl_data->wglSwapIntervalEXT = + WIN_GL_GetProcAddress(this, "wglSwapIntervalEXT"); + this->gl_data->wglGetSwapIntervalEXT = + WIN_GL_GetProcAddress(this, "wglGetSwapIntervalEXT"); + } else { this->gl_data->wglSwapIntervalEXT = NULL; this->gl_data->wglGetSwapIntervalEXT = NULL; } @@ -470,9 +475,8 @@ break; case SDL_GL_ACCELERATED_VISUAL: wgl_attrib = WGL_ACCELERATION_ARB; - this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, - pixel_format, 0, - 1, &wgl_attrib, + this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, + 0, 1, &wgl_attrib, value); if (*value == WGL_NO_ACCELERATION_ARB) { *value = SDL_FALSE; @@ -483,15 +487,17 @@ break; case SDL_GL_SWAP_CONTROL: if (this->gl_data->wglGetSwapIntervalEXT) { - return this->gl_data->wglGetSwapIntervalEXT(); + *value = this->gl_data->wglGetSwapIntervalEXT(); + return 0; } else { return -1; } + break; default: return (-1); } - this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, - 0, 1, &wgl_attrib, value); + this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 0, + 1, &wgl_attrib, value); return 0; } @@ -551,6 +557,14 @@ case SDL_GL_MULTISAMPLESAMPLES: *value = 1; break; + case SDL_GL_SWAP_CONTROL: + if (this->gl_data->wglGetSwapIntervalEXT) { + *value = this->gl_data->wglGetSwapIntervalEXT(); + return 0; + } else { + return -1; + } + break; default: retval = -1; break; @@ -653,4 +667,5 @@ } #endif /* SDL_VIDEO_OPENGL */ + /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/x11/SDL_x11gl.c Fri Jun 23 09:01:08 2006 +0000 +++ b/src/video/x11/SDL_x11gl.c Sat Jun 24 02:48:55 2006 +0000 @@ -411,9 +411,10 @@ break; case SDL_GL_SWAP_CONTROL: if (this->gl_data->glXGetSwapIntervalMESA) { - return this->gl_data->glXGetSwapIntervalMESA(); + *value = this->gl_data->glXGetSwapIntervalMESA(); + return (0); } else { - return (-1) /*(this->gl_config.swap_control > 0) */ ; + return (-1); } break; default: @@ -567,3 +568,5 @@ } #endif /* SDL_VIDEO_OPENGL_GLX */ + +/* vi: set ts=4 sw=4 expandtab: */
--- a/test/testgl.c Fri Jun 23 09:01:08 2006 +0000 +++ b/test/testgl.c Sat Jun 24 02:48:55 2006 +0000 @@ -746,7 +746,7 @@ } if (strncmp(argv[i], "-h", 2) == 0) { printf - ("Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-fullscreen]\n", + ("Usage: %s [-twice] [-logo] [-logocursor] [-slow] [-bpp n] [-gamma n] [-noframe] [-fsaa] [-accel] [-sync] [-fullscreen]\n", argv[0]); exit(0); }