The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Copying texture back to surface
dandago


Joined: 30 Aug 2013
Posts: 34
I just found out that there's a [img]RenderCopyEx()[/img] function that supports rotation and flipping. I'm guessing that these operations apply to the texture in video memory, and so the surface remains unaffected.

Is there a way I can copy the resulting texture back to an SDL_Surface so that I can save it to disk?
Copying texture back to surface
Alex Szpakowski
Guest

SDL_RenderCopy[Ex] don’t modify the texture at all, they simply draw it to the active render target (or to the screen) using native hardware acceleration.

So you could draw to a render target and then use SDL_RenderReadPixels, although I wouldn’t recommend doing that every frame as SDL_RenderReadPixels can be very slow.
Quote:
On Jan 14, 2016, at 7:51 PM, dandago wrote:
I just found out that there's a [img]RenderCopyEx()[/img] function that supports rotation and flipping. I'm guessing that these operations apply to the texture in video memory, and so the surface remains unaffected.Is there a way I can copy the resulting texture back to an SDL_Surface so that I can save it to disk?
Daniel D'Agostinohttp://gigi.nullneuron.net/gigilabs/
_______________________________________________SDL mailinghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org