GL_EXT_texture_cube_map_array#

Supported Hardware#

Series6, Series6XE, Series6XT

Valid APIs#

OpenGL ES 3.1

Description#

This extension adds the idea of a cube map array to the API, such that multiple cube maps can be stored in a single array texture. This allows things like skyboxes with multiple texture layers to be rendered, whilst only consuming a single texture unit.

Example#

// Generate a cube map array texture
GLuint cubeArrayTexture;
glGenTextures(1, &cubeArrayTexture);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY_EXT, cubeArrayTexture);
// Create the texture storage with 8 layers.
// Number of layers allocated = floor(depth / 6), as there are 6 faces for every cube map. So simply multiply by 6 the number of layers needed.
glTexStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY_EXT, 0, GL_RGBA8, textureWidth, textureHeight, 8 * 6);
[Example]
#extension GL_EXT_texture_cube_map_array : require
uniform lowp samplerCubeArray cubeArrayTexture;
in highp vec3 viewDirection;
in highp float layer;
void main()
{
    ...
    value += texture(cubeArrayTexture, vec4(viewDirection, layer);
    ...
}