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
Should I use direct render or render to big texture?
Ton


Joined: 09 Jun 2015
Posts: 1
Location: Hatyai, Thailand
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.
Naith


Joined: 03 Jul 2014
Posts: 158
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.
Should I use direct render or render to big texture?
Daniel Holth
Guest

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:

Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Should I use direct render or render to big texture?
Jonny D


Joined: 12 Sep 2009
Posts: 932
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 D




On Thu, Jun 11, 2015 at 11:00 AM, Daniel Holth wrote:
Quote:
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:



Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org