Browse files

Workaround missing GLUT functions on non-Mac OS X platforms.

  • Loading branch information...
1 parent a08acdf commit cf4e0669665c7ef2cc9b301137f2891cd71f29a9 @cscott cscott committed Nov 16, 2011
Showing with 11 additions and 0 deletions.
  1. +4 −0 glutbindings/glutbind.cpp
  2. +7 −0 glutbindings/glutbind.h
View
4 glutbindings/glutbind.cpp
@@ -1701,6 +1701,7 @@ void funcWMCloseFunc ( ) {
Handle<Value> GLUTWMCloseFuncCallback(const Arguments& args) {
//if less that nbr of formal parameters then do nothing
if (args.Length() < 1 || !args[0]->IsFunction()) return v8::Undefined();
+#if (GLUT_MACOSX_IMPLEMENTATION >= 2)
//get arguments
//delete previous assigned function
persistentWMCloseFunc.Dispose();
@@ -1709,6 +1710,7 @@ Handle<Value> GLUTWMCloseFuncCallback(const Arguments& args) {
//make call
glutWMCloseFunc((void (*)(void)) funcWMCloseFunc);
+#endif
return v8::Undefined();
}
@@ -1720,8 +1722,10 @@ Handle<Value> GLUTCheckLoopCallback(const Arguments& args) {
if (args.Length() < 0) return v8::Undefined();
//get arguments
+#if (GLUT_MACOSX_IMPLEMENTATION >= 2)
//make call
glutCheckLoop();
+#endif
return v8::Undefined();
}
View
7 glutbindings/glutbind.h
@@ -25,6 +25,13 @@
#define GLUT_WINGDIAPI_DEFINED 1
#endif
+#ifndef GLUT_MACOSX_IMPLEMENTATION
+#define GLUT_MACOSX_IMPLEMENTATION 0
+#endif
+#ifndef GLUT_NO_RECOVERY
+#define GLUT_NO_RECOVERY 0
+#endif
+
#include <stdio.h>
#include <map>
using namespace std;

0 comments on commit cf4e066

Please sign in to comment.