SDL_RenderTexture(3)
π SDL_RenderTexture π
okay so bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_RenderTexture(3). she copies a lil slice of a texture onto whatever your renderer is currently drawing to, and she does it at subpixel precision β yes, subpixel, she's fancy like that. β¨
πΈ NAME πΈ
SDL_RenderTexture β copy a portion of the texture to the current rendering target at subpixel precision. no cap, that's literally her whole job and she eats every time. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_render.h>
bool SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
π FUNCTION PARAMETERS π
rendererβ the renderer that's gonna be doing the copying, i.e. the one who should copy parts of a texture. she's the stage, the texture is the performer. πtextureβ the source texture. the OG. the one getting snipped. πΌοΈsrcrectβ a pointer to the source rectangle, orNULLfor the entire texture. like, do you want a lil piece or the whole thing? your call, bestie. βοΈdstrectβ a pointer to the destination rectangle, orNULLfor the entire rendering target. this is where it lands.NULLmeans she's taking up the whole target, main character energy fr fr. π
β RETURN VALUE β
Returns true on success or false on failure β and if it's a false, don't just sit there guessing, 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. do not, and i mean do not, try to be cute and call her from a worker thread. she is not about that life. π
π§ AVAILABILITY π§
This function is available since SDL 3.2.0. so if you're on something olderβ¦ yeah, that's a vibe check you're failing, babe. π
π SEE ALSO π
and that's the whole page, bestie!! π«Ά this lil masterpiece comes to you courtesy of Simple Directmedia Layer, version SDL 3.4.18 β obsessed with her, honestly. go forth and render, and remember: false means check SDL_GetError(). mwah. πππΈ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms