Simp module

texture_load_from_memory

procedureSource

Like texture_load_from_file, for an image that is already in memory.

Example
#import "File";

file := read_entire_file("sprite.png");
texture: Texture;
if !texture_load_from_memory(*texture, cast([] u8) file) return;

This one is only checked to compile, not run.

texture_load_from_memory :: (
    texture: *Texture,
    memory: [] u8,
    srgb := false,
    build_mipmaps := false
) -> bool

Like texture_load_from_file, for an image that is already in memory.

Parameters

texture: *Texture
gets the pixels.
memory: [] u8
the bytes of an image file.
srgb := false
says the pixels are sRGB-encoded, which is what most image files hold, so they are converted to linear when sampled.
build_mipmaps := false
also makes the half-size levels, so the image looks smooth when drawn small.

Returns

bool
Example
#import "File";

file := read_entire_file("sprite.png");
texture: Texture;
if !texture_load_from_memory(*texture, cast([] u8) file) return;

This one is only checked to compile, not run.

See also