GL_OES_depth_texture#

Supported Hardware#

Series5, Series5XT, Series6, Series6XE, Series6XT

Valid APIs#

OpenGL ES 2.0

Description#

When using a framebuffer, z-buffers need to be specifically supported by attaching a depth render target. Originally this was done with a depth renderbuffer; but these are limited as they cannot be read back later. This extension adds depth textures, which allow the user to read back depth output from a render, enabling techniques such as shadow mapping to occur without resorting to storing the depth in a colour texture.

Note#

This functionality is core to OpenGL ES 3.0.

Example#

// Create a depth texture - generally texture data isn't uploaded for this - but it can be.
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 1024, 1024, 0, GL_DEPTH_COMPONENT,
                GL_UNSIGNED_INT, NULL);