0
votes

Okay so I'm kind of new with OpenGL, but I thought I should learn to use OpenGL as it's currently meant to be used from the word go. So I'm skipping all the fixed pipeline stuff using glew to access OpenGL 3.x and following a tutorial online.

The tutorial online only mentions I will have to install glew itself to begin, as I have a graphics card whose drivers come with OpenGL 4.0. So I'm all set, I've downloaded the win32 version of the glew binaries, installed it, made a project in VC++ 2010 set all the paths, and followed the tutorial and have made a quick OpenGLContext class that makes a render context, and puts it into a Ms Window (without glut). The problem is when I build this class I get an error inside one of the glew header files.

It's concerning a series of header includes involving X11. The tutorial seems to imply that I shouldn't have to go find and download and set up path information for X11, so I don't know what I did wrong. Any help, suggestions, etc?

Here is the specific error: "1>c:\glew\glew-1.5.8\include\gl\glxew.h(97): fatal error C1083: Cannot open include file: 'X11/Xlib.h': No such file or directory"

The only source concerned with the error are a series of include statements at the top of the file stated in the error.

The glew library downloaded can be found here: https://sourceforge.net/projects/glew/files/glew/1.5.8/glew-1.5.8-win32.zip/download

I dunno if this matters, but here's how I've referenced OpenGL and glew in my source

#pragma once 

#include <gl/glew.h>
#include <gl/wglew.h>
#include <gl/GL.h>

#pragma comment(lib, "glew32.lib")
#pragma comment(lib, "opengl32.lib") 

UPDATE: this error was fixed by removing the gl/GL.h include... yeah I dunno either... in any case, this whole project is acting funny...

1
Maybe you accidently installed a GLEW compilation that was meant to be used together with some Window X11 server. Usually you don't need X11 to use GLEW. However something else might be wrong, so a verbatim copy of the reported error, plus some source code are the only way to tell.datenwolf

1 Answers

1
votes

The GLEW installation guide mentions that glew.h should replace gl.h.

The simpler but less flexible way is to include glew.h and glew.c into your project. On Windows, you also need to define the GLEW_STATIC preprocessor token when building a static library or executable, and the GLEW_BUILD preprocessor token when building a dll. You also need to replace and with in your code and set the appropriate include flag (-I) to tell the compiler where to look for it.

Also, check out this answer to another question for some of GLEW's tricks.