SFML community forums

Help => Graphics => Topic started by: Mazzelfassel on July 28, 2015, 01:16:46 am

Title: What happens with Sprites that are not in a Window?
Post 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?
Title: Re: What happens with Sprites that are not in a Window?
Post by: G. on July 28, 2015, 02:04:31 am
It is more efficient to check if a sprite is inside the visible area and draw it (or not) accordingly than to draw everything.
Title: Re: What happens with Sprites that are not in a Window?
Post by: Nexus on July 28, 2015, 07:21:02 am
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...)
Title: Re: What happens with Sprites that are not in a Window?
Post by: Mario on July 28, 2015, 10:04:53 am
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.
Title: Re: What happens with Sprites that are not in a Window?
Post by: Mr_Blame on July 28, 2015, 12:25:14 pm
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...
Title: Re: What happens with Sprites that are not in a Window?
Post by: Mazzelfassel on July 28, 2015, 05:14:12 pm
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.