Last modified on 6 July 2012, at 04:49

OpenGL Programming/Installation/Windows

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's manufacturer own implementation of OpenGL.

OpenGLEdit

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.

GLUTEdit

GLEWEdit

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/
make
  • or, you can build GLEW statically, and add glew32s.lib in the linker libraries, in the linker options:
#define GLEW_STATIC
#include <GL/glew.h>

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

GLMEdit

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.


Cross-compilationEdit

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