SFML community forums

Help => Window => Topic started by: LakySimi1 on July 04, 2024, 09:32:22 am

Title: [SOLVED] Can draw tiles outside the window cause problems?
Post by: LakySimi1 on July 04, 2024, 09:32:22 am
Hi everyone,

for my 2D game, to properly draw the world (isometric) and have a smooth panning of world view, it is needed to draw  the sprites that forms the world, walls, enemies etc, partially or completely (keeps things easier) outside the window: can this couse problems/error?

Let's imagine the worst case scenario in wich the sprites are drawed quite far from the window borders, as example at the same window width of distance from them.

Thank you very much in advance!
Title: Re: Can draw tiles outside the window cause problems?
Post by: eXpl0it3r on July 04, 2024, 10:38:15 am
No, OpenGL will cull things that aren't drawn within the view/viewport.

The only "downside" is that, the data itself will still be processed. So if you draw a large map, it can still cause performance issues. If you're currently not running into such issues, I recommend to not worry about it at this point in time.

General performance tips for rendering large worlds. Use a texture atlas for the tiles. Use vertex arrays/buffers to render the geometry. Use a quad tree or similar to split your world into multiple chunks, so that you can only ever render the currently visible chunks.
Title: Re: Can draw tiles outside the window cause problems?
Post by: LakySimi1 on July 04, 2024, 02:48:38 pm
Thank you eXpl0it3e for the direct answer and advices!  :D