X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=demo_prior;a=blobdiff_plain;f=src%2Fopengl.c;h=8b5af75c866d1e1704ed806eca70476c77c2571e;hp=beba99d0dd2b20c770a92434cb2b4fd5801219b0;hb=011184885c5459053d5e3017d8d8a1cab85dc330;hpb=646e75fcb6bdb93c853f6706c23d809c2c63415c diff --git a/src/opengl.c b/src/opengl.c index beba99d..8b5af75 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -1,7 +1,45 @@ #include "opengl.h" +#ifdef __unix__ +#include "glxew.h" + +static Display *dpy; +static Window win; +#endif +#ifdef _WIN32 +#include "wglew.h" +#endif + + int init_opengl(void) { glewInit(); + +#ifdef __unix__ + glxewInit(); + dpy = glXGetCurrentDisplay(); + win = glXGetCurrentDrawable(); +#endif +#ifdef _WIN32 + wglewInit(); +} +#endif + return 0; } + +void gl_swap_interval(int val) +{ +#ifdef __unix__ + if(GLXEW_EXT_swap_control) { + glXSwapIntervalEXT(dpy, win, val); + } else if(GLXEW_SGI_swap_control) { + glXSwapIntervalSGI(val); + } +#endif +#ifdef _WIN32 + if(WGLEW_EXT_swap_control) { + wglSwapIntervalEXT(val); + } +#endif +}