All pastes #896212 Raw Edit

Gem GLEW hax

public text v1 · immutable
·published 2008-02-08 13:39 UTC
rendered paste body
Index: Gem/src/Base/GemGL.h
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Base/GemGL.h,v
retrieving revision 1.14
diff -u -w -r1.14 GemGL.h
--- Gem/src/Base/GemGL.h        11 Oct 2007 11:07:57 -0000      1.14
+++ Gem/src/Base/GemGL.h        8 Feb 2008 13:36:04 -0000
@@ -80,6 +80,7 @@
 /* linux, w32,... */
 # define GL_GLEXT_PROTOTYPES   1
 
+#  include <GL/glew.h>
 #  include <GL/gl.h>
 #  include <GL/glu.h>
 
Index: Gem/src/Base/GemWinCreate.h
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Base/GemWinCreate.h,v
retrieving revision 1.14
diff -u -w -r1.14 GemWinCreate.h
--- Gem/src/Base/GemWinCreate.h 28 Apr 2006 13:32:33 -0000      1.14
+++ Gem/src/Base/GemWinCreate.h 8 Feb 2008 13:36:04 -0000
@@ -17,6 +17,11 @@
 #include "Base/config.h"
 
 #ifdef __unix__
+
+# ifdef USE_GLEW
+#  include <GL/glew.h>
+# endif
+
 # include <GL/glx.h>
 # ifdef HAVE_LIBXXF86VM
 #  include <X11/extensions/xf86vmode.h>
Index: Gem/src/Base/GemWinCreateXWin.cpp
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Base/GemWinCreateXWin.cpp,v
retrieving revision 1.20
diff -u -w -r1.20 GemWinCreateXWin.cpp
--- Gem/src/Base/GemWinCreateXWin.cpp   18 Oct 2006 10:52:22 -0000      1.20
+++ Gem/src/Base/GemWinCreateXWin.cpp   8 Feb 2008 13:36:04 -0000
@@ -273,6 +273,15 @@
   XEvent report;
   XIfEvent(info.dpy, &report, WaitForNotify, (char*)info.win);
   if (glXIsDirect(info.dpy, info.context))post("Direct Rendering enabled!");
+
+#ifdef USE_GLEW
+  GLenum err = glewInit();
+
+  if (GLEW_OK != err) error("failed to init GLEW");
+  else post("GLEW version %s",glewGetString(GLEW_VERSION));
+#endif
+
+
   return(1);
 }
 
Index: Gem/src/Base/config.h
===================================================================
RCS file: /cvsroot/pd-gem/Gem/src/Base/config.h,v
retrieving revision 1.15
diff -u -w -r1.15 config.h
--- Gem/src/Base/config.h       2 Apr 2007 07:36:01 -0000       1.15
+++ Gem/src/Base/config.h       8 Feb 2008 13:36:04 -0000
@@ -62,4 +62,6 @@
 # define HAVE_FFMPEG
 #endif
 
+#define USE_GLEW
+
 #endif /* HAVE_BASE_CONFIG_H_ */