[−][src]Function widgetry::backend_glow::load_textures
pub fn load_textures(
gl: &Context,
filename: &str,
sprite_length: u32
) -> Result<(), Box<dyn Error>>
Uploads a sprite sheet of textures to the GPU so they can be used by Fill::Texture and friends to paint shapes.
path
- image file which is a grid of images.
sprite_length
- the width and height of an individual cell in the image grid
The image file can have any number of sprites, but they must all be the same size.
Once uploaded, textures are addressed by their id, starting from 1, from left to right, top to bottom, like so:
┌─┬─┬─┐ │1│2│3│ ├─┼─┼─┤ │4│5│6│ ├─┼─┼─┤ │7│8│9│ └─┴─┴─┘
Texture(0) is reserved for a pure white (no-op) texture.
Implementation is based on the the description of ArrayTextures from: https://www.khronos.org/opengl/wiki/Array_Texture.