SDL_RenderGeometry(3)

πŸ’… SDL_RenderGeometry(3) β€” the SDL3 glow-up page

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, where we're talking about SDL_RenderGeometry, and honestly? she's iconic. this is the one that draws a whole list of triangles for you, optionally with a texture, and optionally with indices pointing into your vertex array. and the kicker: color and alpha modulation happen per vertex, which means SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are just… ignored here. not invited to the party. πŸ’€


✨ NAME ✨

SDL_RenderGeometry β€” Render a list of triangles, optionally using a texture and indices into the vertex array. Color and alpha modulation is done per vertex (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_render.h>

bool SDL_RenderGeometry(SDL_Renderer *renderer,
                   SDL_Texture *texture,
                   const SDL_Vertex *vertices, int num_vertices,
                   const int *indices, int num_indices);

🌸 FUNCTION PARAMETERS 🌸

  • renderer β€” the rendering context. your main character, the canvas holder, the one who does the actual drawing. 🎨
  • texture β€” (optional) the SDL texture to use. optional bestie, so if you don't need one, don't bring one.
  • vertices β€” vertices. yeah. the actual points. the geometry. the whole reason we're here. πŸ“
  • num_vertices β€” number of vertices. count 'em.
  • indices β€” (optional) an array of integer indices into the vertices array. if it's NULL, all vertices will be rendered in sequential order β€” no skipping, no shuffling, just straight down the line. πŸšΆβ™€οΈ
  • num_indices β€” number of indices. again, count 'em. πŸ”’

πŸ’– RETURN VALUE πŸ’–

Returns true on success or false on failure. and if it fails, don't just sit there confused β€” call SDL_GetError() for more information. she'll tell you what went wrong, i promise. 🫢


🧡 THREAD SAFETY 🧡

This function should only be called on the main thread. no off-thread shenanigans. main thread only, periodt. 🚫


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. so if you're on something older, that's a you problem, bestie, go update. ✨


πŸ‘€ SEE ALSO πŸ‘€

go read those too, iykyk. πŸ“š


and that's the whole vibe check, fr fr. this page came to you from Simple Directmedia Layer, version SDL 3.4.18, and it's the SDL_RenderGeometry(3) page β€” slay, bye πŸ’…πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from