maiowines.blogg.se

Sfml and then there was light
Sfml and then there was light











sfml and then there was light

You avoid making draw calls for tiles that can't be seen. You avoid looping over tiles that can't be seen.

sfml and then there was light

Even if SFML does culling of objects, you will get a huge net gain in speed. You are far better off with an algorithmic approach that completely ignores entire swaths of objects that are off screen.įor a tile engine, this is as easy as calculating the bounding tiles of the viewport, and then only looping over those. That said, if you're interested in speed, culling objects on a one-by-one basis when they're outside the viewport is not going to give you much gain. The speed problems are not the rendering in the graphics device, but rather the fact that your game and the high-level graphics API are doing a ton of work by simply considering rendering each tile. Either way, the cost of the actual rendering of each tile is minimal. Otherwise, the GPU will do the culling itself. Simple tile blitting engines will naturally cull objects outside the viewport, as they pretty much have to if using software rendering.













Sfml and then there was light