2 * Copyright (C) 2003 Robert Kooima
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
17 /*---------------------------------------------------------------------------*/
20 static int search(const char *haystack, const char *needle)
24 for (; *haystack; haystack++)
26 for (c = needle; *c && *haystack; c++, haystack++)
30 if ((*c == 0) && (*haystack == ' ' || *haystack == '\0'))
38 /*---------------------------------------------------------------------------*/
47 if ((dpy = glXGetCurrentDisplay()))
49 int scr = DefaultScreen(dpy);
51 PFNGLXSWAPINTERVALSGIPROC _glXSwapInvervalSGI = NULL;
53 if (search(glXQueryExtensionsString(dpy, scr), "GLX_SGI_swap_control"))
55 if ((_glXSwapInvervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
56 glXGetProcAddress((const GLubyte *) "glXSwapIntervalSGI")))
57 _glXSwapInvervalSGI(1);
63 /*---------------------------------------------------------------------------*/
68 /* TODO: Sit down at a Windows machine and make this work.
69 PFNWGLSWAPINTERVALEXTPROC _wglSwapInvervalEXT = NULL;
71 if (search(wglGetExtensionsString(), "WGL_EXT_swap_control"))
73 if ((_wglSwapInvervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
74 wglGetProcAddress((const GLubyte *) "wglSwapIntervalEXT")))
75 _wglSwapInvervalEXT(1);
81 /*---------------------------------------------------------------------------*/
84 #include <OpenGL/OpenGL.h>
89 CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &swap);
93 /*---------------------------------------------------------------------------*/