starseeker wrote on Saturday, January 01, 2011:
I also saw the same thing, and a grep of my system GL include directory only
found them in the glxew.h header.
Rather than just grabbing those two definitions, I decided to see if I could
just add glew directly to glfw (the glew license doesn’t look to be any
problem?). This proved (at least on this platform) to be surprisingly
simple. Here is the patch (I built on X11 only so far, but I imagine the
changes for the other platforms would be equally minimal):
diff -git a/CMakeLists.txt b/CMakeLists.txt
index c99d1fc…e36b16d 100644
– a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,8 @@ include(CheckSymbolExists)
find_package(OpenGL REQUIRED)
set(common_SOURCES
+ ${GLFW_SOURCE_DIR}/src/glew/glew.c
+ ${GLFW_SOURCE_DIR}/src/glew/visualinfo.c
${GLFW_SOURCE_DIR}/src/enable.c
${GLFW_SOURCE_DIR}/src/error.c
${GLFW_SOURCE_DIR}/src/fullscreen.c
@@ -28,6 +30,8 @@ set(common_SOURCES
${GLFW_SOURCE_DIR}/src/window.c
)
+SET(GLFW_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
+
#---------------------------------------------
# Set up GLFW for Win32 and WGL on Windows
#---------------------------------------------
diff -git a/src/x11/platform.h b/src/x11/platform.h
index a243bff…372945a 100644
– a/src/x11/platform.h
+++ b/src/x11/platform.h
@@ -41,6 +41,8 @@
#include <X11/keysym.h>
#include <X11/Xatom.h>
+#include “…/…/include/GL/glxew.h”
+
#include <GL/glx.h>
#include “…/…/include/GL/glfw3.h”
and added the following files from glew 1.5.7
# new file: include/GL/glew.h
# new file: include/GL/glxew.h
# new file: include/GL/wglew.h
# new file: src/glew/glew.c
# new file: src/glew/visualinfo.c
I don’t really have a clear idea yet of the scope of glew vs. glfw and whether
I just committed a cardinal sin, but this appeared to result in every test
building and running without trouble - from my standpoint it also has one
other major advantage in that I need a CMake build system and glew doesn’t
appear to have one of its own. If I’m going to need both glfw and glew to
achieve the effect of seamless cross platform opengl windows (basically I’m
looking for the least-impact approach that’ll let me do that without
maintaining my own code) it’s nice to have all that in one compact drop-in.