GL_OES_texture_cube_map

Supported Hardware

Series5, Series5XT, Series6, Series6XE, Series6XT

Valid APIs

OpenGL ES 1.x

Description

The standard way to render a cube of textures, such as a skybox, is to render from six individual 2D textures, one for each face. This means that the render has to be split, however, so that each face can be rendered with its own texture. This extension adds a new texture layout scheme for efficient rendering of things like skyboxes, by storing the 6 faces of a cubemap in one texture object. As well as this, texture lookups are performed by using a vector that points at the cube, rather than using explicit x,y coordinates.

This extension also adds texture coordinate generation functions to automatically create texture coordinates based on the eye direction of the user, via one of two modes:

  1. Reflection map mode: Generates the coordinates matching the eye-space reflection vector. This is used for standard skybox or other cubemapping.
  2. Normal map mode: Generates the coordinates matching the vertex's transformed eye-space normal. This is often useful for more advanced techniques and diffuse lighting models.

Note

This extension is part of the OpenGL ES 1.x Extension Pack Specification and is core functionality in OpenGL ES 2.0 and 3.0.

Registry Link

http://www.khronos.org/registry/gles/extensions/OES/OES_texture_cube_map.txt

Example

// Create a cubemap texture - have to specify all faces individually. 
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES, 0, GL_RGBA 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData[0]); 
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES, 0, GL_RGBA 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData[1]); 
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES, 0, GL_RGBA 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData[2]); 
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES, 0, GL_RGBA 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData[3]); 
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES, 0, GL_RGBA 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData[4]); 
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES, 0, GL_RGBA 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData[5]);