* Docs: Fix hyperlinks * Update website link generation * Replace website links with actual file path
1.6 KiB
Texture2DArray (WebGL2)
A Texture2DArray holds a array of textures of the same size and format. The entire array can be passed to the shader which uses an extra texture coordinate to sample from. A core feature of Texture2DArrays is that the entire array can passed as a single uniform to and accessed in a GLSL shader.
Texture arrays can be used as texture atlases if all textures are of the same size and format.
Most texture related functionality is implemented by and documented on the Texture base class. For additional information, see OpenGL Wiki.
Usage
Create a new texture array
if (Texture2DArray.isSupported()) {
textureArray = new Texture2DArray(gl, {...});
}
Members
handle- The underlyingWebGLTexturetarget- AlwaysGL.TEXTURE_2D_ARRAYdepth- the number of textures in the arraywidth- width of the texturesheight- height of the texturesformat- format of the textures
Methods
Texture2DArray is a subclass of the Texture and Resource classes and inherit all methods and members of those classes.
Texture2DArray.isSupported(gl)
Returns true if the context supports creation of Texture2DArrays.
constructor
new Texture2DArray(gl, {parameters});
Limits
GL.MAX_ARRAY_TEXTURE_LAYERS- The maximum number of textures in the array (at least 256).
Remarks
- The maximum number of textures in the array is implementation defined, it can be queried via
GL.MAX_ARRAY_TEXTURE_LAYERS(at least 256).