fixed incorrect checking of the existence of GLX_EXT_swap_control and friends
[demo_prior] / src / opengl.c
1 #include "opengl.h"
2
3 #ifdef __unix__
4 #include "glxew.h"
5
6 static Display *dpy;
7 static Window win;
8 #endif
9 #ifdef _WIN32
10 #include "wglew.h"
11 #endif
12
13
14 int init_opengl(void)
15 {
16         glewInit();
17
18 #ifdef __unix__
19         glxewInit();
20         dpy = glXGetCurrentDisplay();
21         win = glXGetCurrentDrawable();
22 #endif
23 #ifdef _WIN32
24         wglewInit();
25 }
26 #endif
27
28         return 0;
29 }
30
31 void gl_swap_interval(int val)
32 {
33 #ifdef __unix__
34         if(GLXEW_EXT_swap_control) {
35                 glXSwapIntervalEXT(dpy, win, val);
36         } else if(GLXEW_SGI_swap_control) {
37                 glXSwapIntervalSGI(val);
38         }
39 #endif
40 #ifdef _WIN32
41         if(WGLEW_EXT_swap_control) {
42                 wglSwapIntervalEXT(val);
43         }
44 #endif
45 }