Some missing defines

anonymous wrote on Monday, December 13, 2010:

Got compile errors while trying to build glfw: missing the following defines:


I don’t know where they should be defined (glxext.h, maybe?) so I just added
them to x11_window.c


diff --git a/src/x11/x11_window.c b/src/x11/x11_window.c
index 0b026b1..bc4f0a0 100644
--- a/src/x11/x11_window.c
+++ b/src/x11/x11_window.c
@@ -35,6 +35,14 @@
 #include <stdio.h>
 #include <stdlib.h>
+    #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT    0x00000004
 // Action for EWMH client messages
 #define _NET_WM_STATE_REMOVE        0

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)

+ ${GLFW_SOURCE_DIR}/src/glew/glew.c
+ ${GLFW_SOURCE_DIR}/src/glew/visualinfo.c
@@ -28,6 +30,8 @@ set(common_SOURCES

# 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.

starseeker wrote on Saturday, January 01, 2011:

Ooops - actually, visualinfo.c should not be a part of the build - it’s just

elmindreda wrote on Monday, January 03, 2011:

Fixes for this and other issues have been pushed. Sorry about the delay.