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

Author Topic: Getting better performance by checking what to draw.  (Read 1501 times)

0 Members and 1 Guest are viewing this topic.

JAKUBW

  • Newbie
  • *
  • Posts: 8
    • View Profile
Getting better performance by checking what to draw.
« on: April 25, 2017, 08:14:06 pm »
Hi everyone!
I'm creating a game, not very advanced one, but there will be a lot of drawing object (Sprites etc.). Most of them are going to be out of the player's sight. I will use ordinary function - just window.draw(mySprite) and my question sounds:
Does it takes GPU when I draw sprites (or some other drawable object) which are not visible for player(out of current window's view)?
If yes:
Does SFML (or OpenGL) checks if the sprite can be visible by the player or I should take care of them and check it manually using current window's view and getGlobalBounds method?
And Does it takes GPU when I draw an fully transparent sprite (with color's alpha set to 0)?

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Getting better performance by checking what to draw.
« Reply #1 on: April 25, 2017, 09:39:56 pm »
It's best not to draw things that aren't visible and it's up to you to "cull" the ones that don't need to draw.
You can use the view and global bounds to do this, yes.

Does it takes GPU when I draw an fully transparent sprite (with color's alpha set to 0)?
Yes, it still draws the sprite and samples the texture and multiplies the resulting colour with the sprite's colour in the same way; it's just that the final colour recognised as having an alpha of 0.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything