SFML community forums
Help => Graphics => Topic started by: Mazzelfassel on July 28, 2015, 01:16:46 am
-
Currently I'm making a 2D simulation game, during the process I asked myself what happens with a sprite that is drawn but isnt visible in a window. Is SFML smart enough to just skip the drawing process or does it take the same Time then drawing in a window? So if I draw like 2000 sprites in my game but only 50 are currently visible in the window, would it be more effective to check if they are visible or just draw them?
-
It is more efficient to check if a sprite is inside the visible area and draw it (or not) accordingly than to draw everything.
-
Please use the Help -> Graphics subforum, this is not a general discussion about the library :)
(Also, this specific question has been answered a lot in the past...)
-
SFML will still try to draw the sprite, since the C++ code doesn't know about what happens during drawing. For example, a vertex shader could move the sprite back into view.
-
No i think that it won't draw because as i remember the OpenGL uses Culling planes so it will cut the full sprite from FrameBuffer maybe...
-
It is more efficient to check if a sprite is inside the visible area and draw it (or not) accordingly than to draw everything.
Thx for the quick answer I'll keep this in mind when I completed the drawing function.