|Available since LÖVE 0.11.0|
|This enum is not supported in earlier versions.|
Types of textures (2D, cubemap, etc.)
- Regular 2D texture with width and height.
- Several same-size 2D textures organized into a single object. Similar to a texture atlas / sprite sheet, but avoids sprite bleeding and other issues.
- Cubemap texture with 6 faces. Requires a custom shader (and Shader:send) to use. Sampling from a cube texture in a shader takes a 3D direction vector instead of a texture coordinate.
- 3D texture with width, height, and depth. Requires a custom shader to use. Volume textures can have texture filtering applied along the 3rd axis.
Array textures can be rendered with love.graphics.drawLayer, with love.graphics.draw and a Quad via Quad:setLayer, or by sending it to a custom Shader. When getting the pixels of a layer of an Array Texture in a shader, a third texture coordinate component is used to choose which layer to get.
When using a custom Shader, each texture type has a different GLSL type.
sampler2D) is a 2D texture.
sampler2DArray) is an array texture.
samplerCube) is a cubemap texture.
sampler3D) is a volume texture.
Texel shader function can be used to sample from all types of textures in a shader.
Texel is recommended instead of
textureCube etc., because the latter do not work across all versions of GLSL supported by LÖVE, whereas Texel does (GLSL 3 removed
texture2D and added a generic
Not all texture types are supported by all systems. love.graphics.getTextureTypes can check for support.
2D and cube texture types are supported everywhere. Array textures require a system that supports OpenGL 3 or OpenGL ES 3. Volume / 3D textures require a system that supports OpenGL 2 or OpenGL ES 3.
Tiếng Việt –