Expand description
GPU textures.
A GPU texture is an object that can be perceived as an array on the GPU. It holds several items and is a dimensional object. Textures are often associated with images, even though their usage in the graphics world can be much larger than that.
Textures (Texture) come in several flavors and the differences lie in:
- The dimensionality: textures can be 1D, 2D, 3D, layered, cube maps, etc. Dimension is encoded
via the
Dimtype, and indexed in the type-system with theDimensionableand its implementors. - The encoding: the items inside textures are called pixels or texels. Those can be
encoded in several ways. They are represented by various types, which are implementors of the
Pixeltrait. - The usage: some textures will be used as images, others will be used to pass arbitrary data around in shaders, etc.
Whatever the flavor, textures have few uses outside of shaders. When a shader wants
to use a texture, it can do it directly, by accessing each pixel by their position inside the
texture (using a normalized coordinates system) or via the use of a Sampler. A Sampler,
as the name implies, is an object that tells the GPU how fetching (sampling) a texture should
occur. Several options there too:
- The GPU can fetch a pixel without sampling. It means that you have to pass the exact coordinates of the pixel you want to access. This is useful when you store arbitrary information, like UUID, velocities, etc.
- The GPU can fetch a pixel with a floating-point coordinates system. How that system works
depends on the settings of
Sampleryou choose. For instance, you can always fetch the nearest pixel to where you sample, or you can ask the GPU to perform a linear interpolation between all neighboring pixels, etc.Samplerallows way more than that, so feel free to read their documentation.
Structs§
- Cubemap
- Cubemap dimension.
- Dim1
- 1D dimension.
- Dim2
- 2D dimension.
- Dim3
- 3D dimension.
- Dim1
Array - 1D array dimension.
- Dim2
Array - 2D dimension.
- Sampler
- A
Samplerobject gives hint on how aTextureshould be sampled. - Texture
- Textures.
Enums§
- Cube
Face - Faces of a cubemap.
- Dim
- Dimension of a texture.
- MagFilter
- Magnification filter.
- MinFilter
- Minification filter.
- Texel
Upload - Texel upload.
- Texture
Error - Errors that might happen when working with textures.
- Wrap
- How to wrap texture coordinates while sampling textures?
Traits§
- Dimensionable
- Class of
Texturedimensions.