SDL Wiki
[ front page | index | search | recent changes | git repo | offline html ]

SDL_LoadTexture

Load a BMP, PNG or JPEG image from a file.

Header File

Defined in <SDL3/SDL_render.h>

Syntax

SDL_Texture * SDL_LoadTexture(SDL_Renderer *renderer, const char *file);

Function Parameters

SDL_Renderer * renderer the renderer to use.
const char * file the file to load.

Return Value

(SDL_Texture *) Returns a pointer to a new SDL_Texture structure or NULL on failure; call SDL_GetError() for more information.

Remarks

The new texture should be freed with SDL_DestroyTexture(). Not doing so will result in a memory leak.

Thread Safety

It is safe to call this function from any thread.

Version

This function is available since SDL 3.6.0.

See Also


CategoryAPI, CategoryAPIFunction, CategoryRender


[ edit | delete | history | feedback | raw ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.