I am currently in the process of trying to get GLEW to work again under Linux for my project (it worked in the recent past before an upgrade), and in the process I came across something that doesn't make sense to me.

In the process of creating a window, before creating an OpenGL context, a number of GLX functions get called. Such as glXChooseFBConfig(). Now, if I were to include "GL/glx.h" directly, I'd get this function immediately. However, since I have to include "GL/glxew.h" first (GLEW complains if glx.h gets included before it), the function gets redefined by GLEW to a function pointer. This function pointer is NULL until it appears to get initialized when I call glewInit(). Problem is, glewInit() fails if I don't already have a valid OpenGL context.

So, I can't use the GLX functions to create a GL context, until I call glewInit, which I can't use until I have a GL context.

What am I missing here? Right now my program is crashing due to NULL function pointer calls (GLX functions), regardless of when I call glewInit(). I have to be doing something wrong...