‘glSwapInterval’ was not declared in this scope

1.6k views Asked by At

I'm trying to port an OpenGL application from Windows to Linux. I'm stuck at a call to glSwapInterval which doesn't sound windows specific, but doesn't seem to exist on Linux. What include am I missing?

2

There are 2 answers

0
genpfault On

Check for the GLX_EXT_swap_control extension and use glXSwapIntervalEXT().

Using something like GLEW (via glxew.h, see the "Platform Specific Extensions" section) makes the extension loading process easier.

2
Andon M. Coleman On

There is no such thing as glSwapInterval (...), because this is fundamentally a window system operation. OpenGL splits the task of managing windows and other platform-specific operation up into separate window APIs, which include WGL (Microsoft Windows), GLX (X11), EGL (OpenGL ES and some other systems) and CGL (OS X).

Because of this split between the core API and window system API, this function will be prefixed with something other than gl, just as SwapBuffers is. On Linux chances are you are using X11, so look for glXSwapIntervalEXT (...).