SDL_Vertex(3type)

πŸ’– SDL_Vertex πŸ’–

okay bestie, welcome to the SDL3 DATATYPES corner of the manual, and today's main character is SDL_Vertex(3type) β€” the vertex structure. it's giving tiny-but-powerful. it's giving "three little fields that make a whole shape happen". slay.


✨ NAME ✨

SDL_Vertex β€” the Vertex structure. that's it, that's the whole name. short, sweet, iconic. πŸ’…


🌸 SYNOPSIS 🌸

first things first, you gotta pull in the header:

#include <SDL3/SDL_render.h>

and then, boom, here's the whole struct, exactly as it lives, no cap:

typedef struct SDL_Vertex
{
    SDL_FPoint position;        /**< Vertex position, in SDL_Renderer coordinates  */
    SDL_FColor color;           /**< Vertex color */
    SDL_FPoint tex_coord;       /**< Normalized texture coordinates, if needed */
} SDL_Vertex;

so let's break down the trio, because each field is doing its own lil job:

  • position β€” an SDL_FPoint that holds where this vertex actually sits, measured in SDL_Renderer coordinates. that's the whole "where am I" of it. πŸ“
  • color β€” an SDL_FColor for the vertex color. yes bestie, per-vertex color, we love to see it. 🎨
  • tex_coord β€” an SDL_FPoint with the normalized texture coordinates, if needed. note the "if needed" β€” it's optional energy, don't stress if you're not texturing anything. πŸ¦‹

πŸ’œ AVAILABILITY πŸ’œ

this struct has been around since SDL 3.2.0. so if you're on anything older than that... yeah, no vertex for you, sorry bestie. 😭


and that's the whole page, periodt. this lil rewrite was brought to you by the good folks over at Simple Directmedia Layer, rockin' SDL 3.4.18, and yes, SDL_Vertex(3type) is officially a 3type. go forth and render something gorgeous, i'm obsessed. πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from