Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED] Can draw tiles outside the window cause problems?  (Read 1550 times)

0 Members and 2 Guests are viewing this topic.

LakySimi1

  • Newbie
  • *
  • Posts: 35
    • View Profile
[SOLVED] Can draw tiles outside the window cause problems?
« 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!
« Last Edit: July 29, 2024, 10:00:26 pm by LakySimi1 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10988
    • View Profile
    • development blog
    • Email
Re: Can draw tiles outside the window cause problems?
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

LakySimi1

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Can draw tiles outside the window cause problems?
« Reply #2 on: July 04, 2024, 02:48:38 pm »
Thank you eXpl0it3e for the direct answer and advices!  :D

 

anything