Textures are essentially images: a 2D grid of color values. However,
this is a great simplification. Textures can be used to store any
kind of data that can be encoded into color channels. The
(chickadee graphics texture)
module provides an interface for
working with texture objects.
Load the image data from file and return a new texture object.
min-filter and mag-filter describe the method that should
be used for minification and magnification when rendering,
respectively. Possible values are nearest
and linear
.
wrap-s and wrap-t describe how to interpret texture
coordinates that are greater than 1.0
. Possible values are
repeat
, mirrored-repeat
, clamp
,
clamp-to-border
, and clamp-to-edge
.
For color-keyed images (images where a specific color should be made transparent), specify the appropriate transparent-color.
Return #t
if obj is a texture.
Return #t
if obj is a texture region.
If texture is a texture region, return the full texture that it
is based upon. Otherwise, return #f
.
Return the minification filter for texture, either
nearest
or linear
.
Return the magnification filter for texture, either
nearest
or linear
.
Return the method used for wrapping texture coordinates along the X axis for texture.
Possible wrapping methods:
repeat
clamp
clamp-to-border
clamp-to-edge
Return the method used for wrapping texture coordinates along the Y axis for texture.
Return the width of texture in pixels.
Return the height of texture in pixels.
Return the current texture associated with texture unit 0 on the GPU.
Return the current texture associated with texture unit 1 on the GPU.
Return the current texture associated with texture unit 2 on the GPU.
Return the current texture associated with texture unit 3 on the GPU.
Return the current texture associated with texture unit 4 on the GPU.
Render state for texture unit 0 (see Rendering Engine.)
Render state for texture unit 1 (see Rendering Engine.)
Render state for texture unit 2 (see Rendering Engine.)
Render state for texture unit 3 (see Rendering Engine.)
Render state for texture unit 4 (see Rendering Engine.)
It is common practice to combine multiple bitmap images into a single texture, known as a “tile atlas” or “tile set”, because it is more efficient to render many regions of a large texture than it is to render a bunch of small textures. Chickadee provides a tile atlas data type for collecting texture regions into a single vector.
Return a new texture atlas that splits texture into a grid of tile-width by tile-height rectangles. Optionally, each tile may have spacing pixels of horizontal and vertical space between surrounding tiles and the entire image may have margin pixels of empty space around its border.
This type of texture atlas layout is very common for 2D tile maps. See Tile Maps for more information.
Return a new texture atlas that splits the texture loaded from the
file file-name into a grid of tile-width by
tile-height rectangles. See load-image
and
split-texture
for information about all keyword arguments.
Return #t
if obj is a texture atlas.
Return the texture that all texture regions in atlas have been created from.
Return the texture region in atlas at index.
A cube map is a special type of texture composed of 6 images that can be thought of as forming the 6 faces of a cube. See Skyboxes for a practical use of cube maps.
Return a new cube map that uses the image data in the files right, left, top, bottom, front, and back for the 6 faces of the cube.
Return #t
if obj is a cube map.