API reference / Windows and drawing
SDL_RenderGeometry
Function, SDL3
Draws triangles from a list of vertices. The graphics card fills each triangle and blends the vertex colors across it.
Declaration
#include <SDL3/SDL.h>
bool SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices);Parameters
renderer | The renderer. |
texture | A texture for the triangles, or NULL for plain color. |
vertices | An array of vertices. |
num_vertices | The number of vertices. |
indices | An optional array that lists vertices in order, or NULL to use them in order. |
num_indices | The number of indices, or 0. |
Return value
True on success. On failure it returns false.
Example
SDL_RenderGeometry(renderer, NULL, vertices, 3, NULL, 0);See this code run in Draw shapes. Download the full program (.zip)
Notes
- In SDL3, a vertex color is an
SDL_FColor, with parts from 0.0 to 1.0.
In SDL2
The name is the same, but a vertex color is an SDL_Color, with parts from 0 to 255.