OpenGL Programming/Installation/Windows

From Wikibooks, open books for an open world
Jump to: navigation, search

The Microsoft Windows operating system following Windows 95 all come with an OpenGL implementation bundled (usually version 1.4). However, if you installed (or updated) the drivers for your graphics card it's probable that you're using your board manufacturer's own implementation of OpenGL.


The OpenGL library can usually be found by the name OpenGL32.dll under the \system32 folder, located in your system's root folder (usually c:\windows).

Headers compatible with OpenGL are bundled with most compilers. The header's versions may not be fully updated to your running implementation of OpenGL. If so, the new functions must be linked manually using the OpenGL's extension system.



GLEW's official release is meant to work with visualc++ - but if you're using MinGW/GCC with Code::Blocks, no worry - you can:

  • link directly to the .dll (instead of adding the mingw-incompatible .lib)
  • or, you can recompile it and use it as a shared library, using MSys:
cd glew-1.7.0/
  • or, you can build GLEW statically, and add glew32s.lib in the linker libraries, in the linker options:
#include <GL/glew.h>

GLew only compiles statically under Windows (not cross-compiling from GNU/Linux) but doesn't have this issue.


GLM is a headers-only library, so you just need to unzip the GLM release to a directory, and add that directory to your include path in the project properties.


To cross-compile GLEW (download the .tgz release):

cd /usr/src/glew-1.7.0/
make SYSTEM=linux-mingw32

Sample cross-compilation command line:

i586-mingw32msvc-g++ triangle.cpp ../common/shader_utils.cpp \
  -I/usr/src/freeglut/include -L/usr/src/freeglut/lib -lfreeglut \
  -I/usr/src/glew-1.7.0-mingw/include/ -L/usr/src/glew-1.7.0-mingw/lib/ -lglew32 \
  -lopengl32 -mwindows -o triangle.exe

< OpenGL Programming/Installation

Browse & download complete code