WebGL
Khronos
 

WebGL WEBGL_depth_texture Khronos Ratified Extension Specification

Name

WEBGL_depth_texture

Contact

WebGL working group (public_webgl 'at' khronos.org)

Contributors

Members of the WebGL working group

Florian Bösch (pyalot 'at' gmail.com)

Version

Last modified date: July 15, 2014
Revision: 12

Number

WebGL extension #9

Dependencies

Written against the WebGL API 1.0 specification.

Overview

This extension exposes the ANGLE_depth_texture functionality to WebGL. ANGLE_depth_texture provides a subset of the functionality from the OpenGL ES 2.0 extensions OES_depth_texture and OES_packed_depth_stencil, with certain restrictions added for portability reasons. Specifically:

Consult the Errors section below for specific restrictions.

When this extension is enabled:

Alias Name Strings (for draft extensions)

IDL

[NoInterfaceObject]
interface WEBGL_depth_texture {
  const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA;
};
  

Errors

The error INVALID_OPERATION is generated by texImage2D if the format parameter is DEPTH_COMPONENT or DEPTH_STENCIL and the target is TEXTURE_CUBE_MAP_{POSITIVE,NEGATIVE}_{X,Y,Z}.
The error INVALID_OPERATION is generated by texImage2D if format and internalformat are DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT.
The error INVALID_OPERATION is generated by texImage2D if format and internalformat are not DEPTH_COMPONENT and type is UNSIGNED_SHORT or UNSIGNED_INT.
The error INVALID_OPERATION is generated by texImage2D if format and internalformat are DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
The error INVALID_OPERATION is generated by texImage2D if format and internalformat are not DEPTH_STENCIL and type is UNSIGNED_INT_24_8_WEBGL.
The error INVALID_OPERATION is generated in the following situations:

Issues

As per the ANGLE_depth_texture specification, when a depth texture is sampled, the value is stored into the RED channel. The contents of the GREEN, BLUE and ALPHA channels are implementation dependent. It is therefore recommended to use only the r component of variables in GLSL shaders that are used to reference depth textures.

Revision History

Revision 1, 2012/01/23

Revision 2, 2012/01/25

Revision 3, 2012/02/06

Revision 4, 2012/02/24

Revision 5, 2012/03/01

Revision 6, 2012/06/04

Revision 7, 2012/06/20

Revision 8, 2012/06/27

Revision 9, 2013/01/26

Revision 10, 2013/02/28

Revision 11, 2013/05/15

Revision 12, 2014/07/15