TTF_GetGPUTextDrawData(3)
β¨ NAME β¨
TTF_GetGPUTextDrawData β bestie, this is the one that hands you the geometry data you need to actually draw your text. π
π HEADER FILE π
It lives in SDL3_ttf/SDL_ttf.h, duh. π¦
πΈ SYNOPSIS πΈ
#include "SDL3_ttf/SDL_ttf.h"
TTF_GPUAtlasDrawSequence * TTF_GetGPUTextDrawData(TTF_Text *text);
π DESCRIPTION π
okay so first things first: your text must have been created using a TTF_TextEngine that came from
TTF_CreateGPUTextEngine()
like, that's non-negotiable bestie, that's the whole vibe check. π₯
Now for the coordinate situation, and this is the part where you gotta pay attention: the positive X-axis goes off to the right, and the positive Y-axis goes upwards β and that's true for both the vertex coordinates and the texture coordinates. It's giving very much the same convention the SDL_GPU API uses, so if you're already comfy there you're golden. β¨ But if you wanna use a different coordinate system? Then you gotta transform the vertices yourself, no cap. That's on you, not on this function. π
Oh and one more lil thing β if your text is looking blocky, use linear filtering. That's the fix, that's the tea. π«Ά
π FUNCTION PARAMETERS π
textβ the text you wanna draw. that's it, that's the parameter. π
β RETURN VALUE β
It returns a TTF_GPUAtlasDrawSequence * β which is a NULL terminated linked list of TTF_GPUAtlasDrawSequence objects. π
And if things go sideways? You get NULL back when the text you passed in is empty, or in case of failure. Call SDL_GetError() for more info, she'll tell you what went wrong. π
π§ THREAD SAFETY π§
Real talk: call this on the thread that created the text. Don't be out here being messy across threads. π
π AVAILABILITY π
This function has been available since SDL_ttf 3.0.0. Iconic behavior, honestly. π
π¦ SEE ALSO π¦
β’(3)TTF_CreateGPUTextEngine(3)β’(3)TTF_CreateText(3)
k bye bestie, go forth and render that text, you got this fr fr πβ¨πΈ
this lil love letter came to you from SDL_ttf 3.2.2 β mwah, xoxo π
π¦ where this page comes from
- debian trixie: libsdl3-ttf-doc 3.2.2+ds-1 Β· Zlib
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- ubuntu questing: libsdl3-ttf-doc 3.2.2+ds-1
- ubuntu resolute: libsdl3-ttf-doc 3.2.2+ds-1build1 Β· Zlib
- ubuntu stonking: libsdl3-ttf-doc 3.2.2+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms