al_set_shader_sampler(3)
π NAME π
Welcome to the Library Functions Manual, bestie β this is al_set_shader_sampler(3) from the Allegro 5 API π
al_set_shader_sampler β the Allegro 5 API function for setting a shader sampler, no cap.
β¨ SYNOPSIS β¨
#include <allegro5/allegro.h>
bool al_set_shader_sampler(const char *name,
ALLEGRO_BITMAP *bitmap, int unit)
π DESCRIPTION π
Okay so hereβs the tea: this sets a texture sampler uniform and texture unit of the current target bitmapβs shader. The given bitmap must be a video bitmap β that part is not optional, bestie π«Ά
Different samplers should use different units. The bitmap passed to Allegroβs drawing functions uses the 0th unit, so if youβre planning on using the al_tex variable in your pixel shader as well as another sampler, set the other sampler to use a unit different from 0 β¨
With the primitives addon, it is possible to free up the 0th unit by passing NULL as the texture argument to the relevant drawing functions. In this case, you may set a sampler to use the 0th unit and thus not use al_tex (the al_use_tex variable will be set to false) π
Returns true on success. Otherwise returns false, e.g. if the uniform by that name does not exist in the shader. Thatβs the whole return situation, periodt π
β SINCE β
5.1.0 β yes bestie, this one has been around since 5.1.0 π
π SEE ALSO π
al_use_shader(3)β go peek at this one too, iykyk π¦
π Cute sign-off from the Allegro reference manual β thatβs the source/version line energy, and the footer didnβt include a date, so weβre not inventing one. al_set_shader_sampler(3), out π
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms