The OpenGL versioning mess

Notes about various OpenGL versions.

OpenGL headers

GLEW

#include <glew.h>

Will automatically include GL/gl.h or anything relevant.

Most other OpenGL platforms

Including Linux, Windows.

#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>

Mac OS X

Check for both __APPLE__ and __MACH__.

#define MACOS_OPENGL
#define GL_GLEXT_PROTOTYPES
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>

OpenGL ES headers

Most OpenGL ES platforms

Android, NaCl.

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

Apple iOS

#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>

Old OpenGL ES 1.x systems

#include <GLES/gl.h>
#include <GLES/glext.h>

PSGL

#include <PSGL/psgl.h>
#include <PSGL/psglu.h>

Will include GLES/gl.h in turn.

Version Macros

OpenGL

All versions of OpenGL provide a version number in addition to the previous versions:

#define GL_VERSION_1_1 1
#define GL_VERSION_1_2 1
#define GL_VERSION_1_2_1 1
#define GL_VERSION_1_3 1
#define GL_VERSION_1_4 1
#define GL_VERSION_1_5 1

#define GL_VERSION_2_0 1
#define GL_VERSION_2_1 1

#define GL_VERSION_3_0 1
#define GL_VERSION_3_1 1
#define GL_VERSION_3_2 1
#define GL_VERSION_3_3 1

#define GL_VERSION_4_0 1
#define GL_VERSION_4_1 1

OpenGL ES 1.0

#define GL_OES_VERSION_1_0 1

OpenGL ES 1.1

#define GL_VERSION_ES_CM_1_0 1
#define GL_VERSION_ES_CL_1_0 1
#define GL_VERSION_ES_CM_1_1 1
#define GL_VERSION_ES_CL_1_1 1

OpenGL ES 2.0

#define GL_ES_VERSION_2_0 1

Shader languages

GLSL

These macros are available:

__LINE__
__FILE__
__VERSION__

GLSL ES 1.0

These macros are available:

__LINE__
__FILE__
__VERSION__
GL_ES

VERSION is set to 100, GL_ES is set to 1 (section 3.4, page 12).

Last modified 4 years ago Last modified on Oct 26, 2012, 3:44:20 PM