Permalink
Browse files

Add wglSwapIntervalEXT

  • Loading branch information...
1 parent aba4b46 commit 24ead94c1f3874b1eb90a9ba5cc33b69c8f7e9bd @ccherng ccherng committed Jul 23, 2012
Showing with 48 additions and 0 deletions.
  1. +45 −0 gl42/ext_windows.go
  2. +3 −0 gl42/gl42.go
View
45 gl42/ext_windows.go
@@ -0,0 +1,45 @@
+// +build windows
+
+package gl42
+
+// #include <stdlib.h>
+// #define WIN32_LEAN_AND_MEAN 1
+// #include <windows.h>
+//
+// #ifndef APIENTRY
+// #define APIENTRY
+// #endif
+// #ifndef APIENTRYP
+// #define APIENTRYP APIENTRY *
+// #endif
+//
+// typedef unsigned char GLboolean;
+// typedef int GLint;
+//
+// void* goglGetProcAddress(const char* name);
+//
+// GLboolean (APIENTRYP ptrwglSwapIntervalEXT)(GLint interval);
+//
+// GLboolean gowglSwapIntervalEXT(GLint interval) {
+// return (*ptrwglSwapIntervalEXT)(interval);
+// }
+//
+// int init_WGL() {
+// ptrwglSwapIntervalEXT = goglGetProcAddress("wglSwapIntervalEXT");
+// if(ptrwglSwapIntervalEXT == NULL) return 1;
+// return 0;
+// }
+import "C"
+import "errors"
+
+func InitWgl() error {
+ var ret C.int
+ if ret = C.init_WGL(); ret != 0 {
+ return errors.New("unable to initialize WGL")
+ }
+ return nil
+}
+
+func SwapInterval(interval Int) Boolean {
+ return (Boolean)(C.gowglSwapIntervalEXT((C.GLint)(interval)))
+}
View
3 gl42/gl42.go
@@ -6771,6 +6771,9 @@ func Init() error {
if err = InitVersion20(); err != nil {
return err
}
+ if err = InitWgl(); err != nil {
+ return err
+ }
return nil
}
//Go bool to GL boolean.

0 comments on commit 24ead94

Please sign in to comment.