SDL_SetTextureAlphaModFloat(3)
π SDL_SetTextureAlphaModFloat(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we talk about making your textures β¨translucentβ¨. This one's called SDL_SetTextureAlphaModFloat, and it's giving main character energy for real.
β¨ NAME β¨
SDL_SetTextureAlphaModFloat β set an extra alpha value that gets multiplied into render copy operations. slay
π¦ SYNOPSIS π¦
#include <SDL3/SDL_render.h>
bool SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha);
πΈ DESCRIPTION πΈ
so here's the tea: when this texture gets rendered, during the copy operation the source alpha value gets modulated by this alpha value. The formula is literally this, no cap:
srcA = srcA * alpha
that's it. that's the whole vibe. π«Ά
lowkey important: alpha modulation is not always supported by the renderer. if it's not supported, this function will return false. so like, check your returns, bestie. π
π FUNCTION PARAMETERS π
textureβ the texture you're updating. the one getting the glow-up.alphaβ the source alpha value that gets multiplied into copy operations.
π RETURN VALUE π
Returns true on success or false on failure. and if it fails? call SDL_GetError() for more information, because she will tell you what went wrong. π
π₯ THREAD SAFETY π₯
This function should only be called on the main thread. no side-quests, no background threads, just main character behavior. periodt.
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on something older, it's not me, it's you. π
π SEE ALSO π
Simple Directmedia Layer π SDL 3.4.18 β mwah, that's the whole page, SDL_SetTextureAlphaModFloat(3) out. go forth and modulate those alphas, bestie π§β¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms