SDL_TextureAddressMode(3type)
π SDL_TextureAddressMode π
okay bestie, welcome to the SDL3 DATATYPES corner of the manual, this one's all about SDL_TextureAddressMode and it's lowkey one of those tiny enums that does a LOT of heavy lifting. sit down, grab a strawberry π, let's go.
β¨ NAME β¨
SDL_TextureAddressMode β the addressing mode for a texture when it's being used in SDL_RenderGeometry().
that's it. that's the whole vibe. it tells the renderer how to read your texture coords when they wander off the edges. π¦
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_render.h>
typedef enum SDL_TextureAddressMode
{
SDL_TEXTURE_ADDRESS_INVALID = -1,
SDL_TEXTURE_ADDRESS_AUTO, /**< Wrapping is enabled if texture coordinates are outside [0, 1], this is the default */
SDL_TEXTURE_ADDRESS_CLAMP, /**< Texture coordinates are clamped to the [0, 1] range */
SDL_TEXTURE_ADDRESS_WRAP /**< The texture is repeated (tiled) */
} SDL_TextureAddressMode;
look at her. iconic. the -1 sentinel at the top? main character energy. periodt. π
π DESCRIPTION π
so like. this enum decides how texture coordinates get interpreted when they're outside of [0, 1]. that's literally the whole job. you go past 1.0 or below 0.0 and this is the thing that decides what happens next. no cap.
Texture wrapping is always supported for power of two texture sizes π β easy, free, no notes.
for other texture sizes, wrapping is supported only if SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN is set to true. so if you're out here with a non-power-of-two texture and you didn't flip that property, that's a vibe check you're gonna fail, ngl. π
β AVAILABILITY β
this enum has been available since SDL 3.4.0. she's not ancient, she's fresh. β¨
π«Ά the values, one by one π«Ά
SDL_TEXTURE_ADDRESS_INVALID = -1β the invalid one. it's giving "something went wrong, why are you here". πSDL_TEXTURE_ADDRESS_AUTOβ wrapping is enabled if texture coordinates are outside[0, 1]. this is the default, so if you never touched this setting, this is what you've been getting the whole time. surprise! πSDL_TEXTURE_ADDRESS_CLAMPβ texture coordinates are clamped to the[0, 1]range. edge pixels just stretch out forever. no repeat, no tile, just hold still. πΈSDL_TEXTURE_ADDRESS_WRAPβ the texture is repeated (tiled). this is the tiling one. she repeats. she's a pattern. she ate. π₯
heads up bestie: if your texture isn't a power of two and you want that wrapping life,SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEANhas to betrue. don't come crying to me, come crying to the property. π
okay that's the page!! go forth and address your textures responsibly. this was Simple Directmedia Layer, rocking SDL 3.4.18, and you just read SDL_TextureAddressMode(3type). mwah π slay your render geometry 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