#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
This is an example, but where to get GL headers?
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
This is an example, but where to get GL headers?
What operating system?
Here on Ubuntu, I have
$ dpkg -S /usr/include/GL/gl.h
mesa-common-dev: /usr/include/GL/gl.h
$
but not the difference in a) capitalization and b) forward/backward slashes. Your example is likely to be wrong in its use of backslashes.
In Visual Studio :
//OpenGL
#pragma comment(lib, "opengl32")
#pragma comment(lib, "glu32")
#include <gl/gl.h>
#include <gl/glu.h>
Headers are in the SDK : C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl
If you're on Windows, they are installed with the platform SDK (or Visual Studio). However the header files are only compatible with OpenGL 1.1. You need to create function pointers for new functionality it later versions. Can you please clarify what version of OpenGL you're trying to use.
Linux:
sudo apt-get update
OpenGL: sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
Windows:
Locate your Visual Studio folder for where it puts libraries and also header files, download and copy lib files to lib folder and header files to header. Then copy dll files to system32. Then your code will 100% run.
Also[Windows]:For all of those includes you just need to download glut32.lib glut.h glut32.dll
On Windows you need to include the gl.h
header for OpenGL 1.1 support and link against OpenGL32.lib. Both are a part of the Windows SDK. In addition, you might want the headers wglext.h
and glext.h
which you can get from http://www.opengl.org/registry .wglext.h
has typedefs for Windows-specific extensions, and glext.h is the header which holds mostly platform-agnostic extensions and OpenGL core functionality which is later than OpenGL version 1.1.
On Linux you need to link against libGL.so, which is usually a symlink to libGL.so.1, which is yet a symlink to the actual library/driver which is a part of your graphics driver. For example, on my system the actual driver library is named libGL.so.256.53, which is the version number of the nvidia driver I use. You also need to include the gl.h
header, which is usually a part of a Mesa or Xorg package. Again, you might need glext.h
and glxext.h
from http://www.opengl.org/registry . glxext.h
holds GLX extensions, the equivalent to wglext.h
on Windows.
If you want to use OpenGL 3.x or OpenGL 4.x functionality without the functionality which were moved into the GL_ARB_compatibility
extension, use the new gl3.h
header from the registry webpage. It replaces gl.h
and also glext.h
(as long as you only need core functionality).
Last but not the least, glaux.h
is not a header associated with OpenGL. I assume you've read the awful NEHE tutorials and just went along with it. Glaux is a horribly outdated Win32 library (1996) for loading uncompressed bitmaps. Use something better, like libPNG, which also supports alpha channels.