Difference between revisions of "TextureType"
(Created page) |
m (Changed version from 0.11.0 to 11.0) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | {{newin|[[ | + | {{newin|[[11.0]]|110|type=enum}} |
Types of textures (2D, cubemap, etc.) | Types of textures (2D, cubemap, etc.) | ||
Line 12: | Line 12: | ||
− | When using a custom Shader, each texture type has a different | + | When using a custom Shader, each texture type has a different GLSL type. |
* <code>Image</code> (or <code>sampler2D</code>) is a 2D texture. | * <code>Image</code> (or <code>sampler2D</code>) is a 2D texture. | ||
* <code>ArrayImage</code> (or <code>sampler2DArray</code>) is an array texture. | * <code>ArrayImage</code> (or <code>sampler2DArray</code>) is an array texture. | ||
Line 19: | Line 19: | ||
− | The <code>Texel</code> function can be used to sample from all types of textures. <code>Texel</code> is recommended instead of <code>texture2D</code>, <code>textureCube</code> etc., because the latter do not work across all versions of GLSL supported by LÖVE, whereas Texel does (GLSL 3 removed <code>texture2D</code> and added a generic <code>texture</code> function). | + | The <code>Texel</code> shader function can be used to sample from all types of textures in a shader. <code>Texel</code> is recommended instead of <code>texture2D</code>, <code>textureCube</code> etc., because the latter do not work across all versions of GLSL supported by LÖVE, whereas Texel does (GLSL 3 removed <code>texture2D</code> and added a generic <code>texture</code> function). |
Latest revision as of 03:25, 2 May 2018
Available since LÖVE 11.0 |
This enum is not supported in earlier versions. |
Types of textures (2D, cubemap, etc.)
Contents
Constants
- 2d
- Regular 2D texture with width and height.
- array
- Several same-size 2D textures organized into a single object. Similar to a texture atlas / sprite sheet, but avoids sprite bleeding and other issues.
- cube
- 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.
- volume
- 3D texture with width, height, and depth. Requires a custom shader to use. Volume textures can have texture filtering applied along the 3rd axis.
Notes
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.
Image
(orsampler2D
) is a 2D texture.ArrayImage
(orsampler2DArray
) is an array texture.CubeImage
(orsamplerCube
) is a cubemap texture.VolumeImage
(orsampler3D
) is a volume texture.
The Texel
shader function can be used to sample from all types of textures in a shader. Texel
is recommended instead of texture2D
, 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 texture
function).
Each texture type has a different maximum size on a user's system. Use love.graphics.getSystemLimits to check.
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.
See Also
- love.graphics
- Texture
- Texture:getTextureType
- love.graphics.newImage
- love.graphics.newArrayImage
- love.graphics.newCubeImage
- love.graphics.newVolumeImage
- love.graphics.newCanvas
- love.graphics.drawLayer
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info