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

Author Topic: Culling in SFML's built-in classes  (Read 1637 times)

0 Members and 1 Guest are viewing this topic.

Conduit

  • Newbie
  • *
  • Posts: 30
    • View Profile
Culling in SFML's built-in classes
« on: February 10, 2015, 04:26:29 am »
Hello all.

I'm currently building a handful of GUI classes for use in several of my projects. Development is going well, and I have begun work on a class which is (somewhat) equivalent to C#'s 'ListBox'. Internally the class is using an sf::View to handle rendering, scrolling, and so forth. This leads me to a possible problem... If the list of objects the class is responsible for is large, then the draw commands could represent a serious inefficiency - it is quite likely that the bulk of the objects in the list are not visible based on the scroll position and don't actually need to be drawn. As a result, culling is an inevitable must-have.

I was wondering if SFML does anything internally to deal with this... Do sf::RenderTarget instances abort the draw process early when trying to draw an object that falls outside their rendering region? If there are any related, built-in efficiency optimizations, I'd love to hear about them.

Thanks!
« Last Edit: February 10, 2015, 04:28:35 am by Conduit »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Culling in SFML's built-in classes
« Reply #1 on: February 10, 2015, 07:42:40 am »
There's absolutely no culling optimization in SFML, you must implement it yourself.
Laurent Gomila - SFML developer

Conduit

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Culling in SFML's built-in classes
« Reply #2 on: February 10, 2015, 08:53:17 am »
Figured as much. I should be able to come up with a simple algorithm to handle it, but I'd rather not reinvent the wheel without having to. Thanks Laurent.