SDL_TextureAddressMode(3type)

πŸ“¦
version 3.4.18 Β· 5 versions
, in fedora 43, fedora 44

πŸ’– 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_BOOLEAN has to be true. 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