v / vlib / stbi / README.md
13 lines · 10 sloc · 728 bytes · 66c72b149fdc9e8ab1ad4d2554fd1050ca36ea03
Raw

Description

stbi is a thin wrapper around stb's stb_image.h, which in turn is "a public domain image loader" for popular graphics image file formats.

By default, stbi.load and stbi.load_from_memory convert images to 4-channel RGBA pixel data. Image.nr_channels reflects that in-memory layout, while Image.original_nr_channels keeps the channel count from the source file as metadata.

When uploading to sokol.gfx, size the upload from width * height * nr_channels. If you load with desired_channels: 0, convert the data yourself or use a matching pixel format before creating a texture. Also call gfx.setup(...) before gfx.make_image(...) and gfx.make_sampler(...).