Should I use direct render or render to big texture?

First sorry for my bad language.English is my foreign language.

If I use SDL_RenderCopy to render small rect from tile texture atlas to big texture then use SDL_RenderCopy and SDL_RenderPresent to present that big texture, Would it faster than I direct use SDL_RenderCopy and SDL_RenderPresent from my tile texture atlas?

I need to change tile in runtime during gameplay because I use chunk for my tile map, so I need to draw 256x256 tiles (each tile is 8x8 pixel) everytime when character move.

I actually measured this a few days ago.

I created a window with the size of 1024x768 and fill the window with 32x32 sized tiles. This means that the window will be filled with 768 tiles.

When I render the tiles in the “usual” way, by looping through my list of tiles and render each tile with SDL_RenderCopy, I get an average FPS of 700.
When I render all the tiles to a render target-texture, by looping through my list of tiles, render them to a target texture and then render the actual target texture, I get an average FPS of 500.

My conclusion to this is that it’s faster, in my case, to render the tiles with alternative 1 above, but I guess it all depends on how optimized the program is, the size of the actual window and such.

You would typically prefer the indirect technique not for speed, but to
perform some additional operations on the texture e.g. compositing it on
top of another scene.On Thu, Jun 11, 2015 at 8:41 AM Naith wrote:

I actually measured this a few days ago.

I created a window with the size of 1024x768 and fill the window with
32x32 sized tiles. This means that the window will be filled with 768 tiles.

When I render the tiles in the “usual” way, by looping through my list of
tiles and render each tile with SDL_RenderCopy, I get an average FPS of 700.
When I render all the tiles to a render target-texture, by looping through
my list of tiles, render them to a target texture and then render the
actual target texture, I get an average FPS of 500.

My conclusion to this is that it’s faster, in my case, to render the tiles
with alternative 1 above, but I guess it all depends on how optimized the
program is, the size of the actual window and such.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

If you’re just using SDL_Renderer, then don’t concern yourself about
performance and focus more on what functionality you need. If performance
becomes a problem, then consider alternative rendering APIs (e.g. direct
OpenGL or SDL_gpu) since there are transparent optimizations that
SDL_Renderer does not yet implement.

Jonny DOn Thu, Jun 11, 2015 at 11:00 AM, Daniel Holth wrote:

You would typically prefer the indirect technique not for speed, but to
perform some additional operations on the texture e.g. compositing it on
top of another scene.

On Thu, Jun 11, 2015 at 8:41 AM Naith wrote:

I actually measured this a few days ago.

I created a window with the size of 1024x768 and fill the window with
32x32 sized tiles. This means that the window will be filled with 768 tiles.

When I render the tiles in the “usual” way, by looping through my list of
tiles and render each tile with SDL_RenderCopy, I get an average FPS of 700.
When I render all the tiles to a render target-texture, by looping
through my list of tiles, render them to a target texture and then render
the actual target texture, I get an average FPS of 500.

My conclusion to this is that it’s faster, in my case, to render the
tiles with alternative 1 above, but I guess it all depends on how optimized
the program is, the size of the actual window and such.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org