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

Author Topic: If object position is out of vissible screen, is it drawn?  (Read 1874 times)

0 Members and 1 Guest are viewing this topic.

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
If object position is out of vissible screen, is it drawn?
« on: September 02, 2013, 06:16:49 pm »
Hello.
If an rectangle with (X=0 Y=0 W=10 H=10) is drawn to a window that its position and size is
(X=100, Y=100, W=600, H=400)
Will the object be drawn and use cpu? or is it gonna check if it is in visible screen and not draw it.
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: If object position is out of vissible screen, is it drawn?
« Reply #1 on: September 02, 2013, 06:19:57 pm »
It will use as much CPU as any other entity, and a little GPU. So if you can easily discard non-visible entities yourself (and your performances need it), then it's a good thing to do.
Laurent Gomila - SFML developer

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
Re: If object position is out of vissible screen, is it drawn?
« Reply #2 on: September 02, 2013, 06:36:56 pm »
Thank you on lightning fast respond  :).
I am just asking that because i drawn 100*100*4+5000*4 vertices that are textures and still getting 600-1200 fps with additional logic thrown in that mix and i am very surprised on that performace.
And most of them go out of screen so i was just wondering.
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: If object position is out of vissible screen, is it drawn?
« Reply #3 on: September 03, 2013, 05:52:29 pm »
Modern GPUs have optimized codepaths/hardware for culling invisible objects. However, if you pre-cull on CPU side, you'll save yourself the (probably small) bandwidth overhead of sending the vertex data to the GPU every frame.