I have a question about image loading in SDL2 with the SDL_image libary.
Unfortunatly i dont find any information about IMG_LoadTexture in the SDL_image documentation. So what is the difference between using IMG_LoadTexture to directly load an PNG image as texture and using IMG_Load to load a surface an then convert it to an texture with SDL_CreateTextureFromSurface? Is there any benefit in using one over the other?
When in doubt, check source (easily browsable at https://hg.libsdl.org/) - https://hg.libsdl.org/SDL_image/file/ca95d0e31aec/IMG.c#l209 :
SDL_Texture *IMG_LoadTexture(SDL_Renderer *renderer, const char *file)
{
SDL_Texture *texture = NULL;
SDL_Surface *surface = IMG_Load(file);
if (surface) {
texture = SDL_CreateTextureFromSurface(renderer, surface);
SDL_FreeSurface(surface);
}
return texture;
}