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 /*---------------------------------------------------------------------------*/
45 Display *dpy = glXGetCurrentDisplay();
46 int scr = DefaultScreen(dpy);
48 PFNGLXSWAPINTERVALSGIPROC _glXSwapInvervalSGI = NULL;
50 if (search(glXQueryExtensionsString(dpy, scr), "GLX_SGI_swap_control"))
52 if ((_glXSwapInvervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
53 glXGetProcAddress((const GLubyte *) "glXSwapIntervalSGI")))
54 _glXSwapInvervalSGI(1);
59 /*---------------------------------------------------------------------------*/
64 /* TODO: Sit down at a Windows machine and make this work.
65 PFNWGLSWAPINTERVALEXTPROC _wglSwapInvervalEXT = NULL;
67 if (search(wglGetExtensionsString(), "WGL_EXT_swap_control"))
69 if ((_wglSwapInvervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
70 wglGetProcAddress((const GLubyte *) "wglSwapIntervalEXT")))
71 _wglSwapInvervalEXT(1);
77 /*---------------------------------------------------------------------------*/
80 #include <OpenGL/OpenGL.h>
85 CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &swap);
89 /*---------------------------------------------------------------------------*/