OpenGL Programming/Installation/Windows

All version of Windows from Windows 95 come with an OpenGL implementation (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.

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, or using a wrapper such as GLEW.

GLEW
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 )
 * or, you can recompile it and use it as a shared library, using MSys:
 * or, you can build GLEW statically: add glew32s.lib to linker libraries in the linker options, and add -DGLEW_STATIC to your compiler flags.


 * Link: The OpenGL Extension Wrangler Library - Installation
 * Link: glew-users : mailing list where I reported the link issue - hopefully the GLEW developers will provide a MinGW-compatible binary release.

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

GLUT

 * freeglut Windows Development Libraries - link with -lfreeglut instead of -lglut32; don't use the Code::Blocks wizard for GLUT projects since it's specific to non-free GLUT
 * Using OpenGL & GLUT in Code::Blocks - good tutorial; add  before including non-free glut.h

GLM
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-compilation
Newer tutorial Makefile's can now be invoked using a MXE-compatible environment, for example:
 * Compile MXE:
 * Prepare environment:
 * Compile as easily as usual:

Debugging note: due to a bug you need to pipe your input to GDB through cat:

= Error logs =

sdl2-config --libs sets the -mwindows option which removes the command black window but also stdout and stderr.

To see e.g. SDL_LogMessage output you can:
 * force console mode:
 * or explicitly redirect stderr:

(If you know why explicit redirection is necessary, feel free to explain.)

OpenGL 프로그래밍/설치/윈도