Convert SDL_Texture to SDL_Surface

Hello there, anyone know how can I convert sdl_texture to Sdl_surface? I want to save it to image file

Render it to a suitable target and then get the pixels using SDL_RenderReadPixels(). It’s not a quick operation, so it’s better not to do it too frequently.

But where did the texture come from originally? Often, you already know what’s in a texture becuse you created it!

Yes I created it , with access target thank you @rtrussell

In that case it’s straightforward because you can call SDL_RenderReadPixels() whilst the texture is selected as the current render target.

1 Like

I want to make well how can I do it please?