SFML community forums

Help => Graphics => Topic started by: Conduit on February 10, 2015, 04:26:29 am

Title: Culling in SFML's built-in classes
Post by: Conduit 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!
Title: Re: Culling in SFML's built-in classes
Post by: Laurent on February 10, 2015, 07:42:40 am
There's absolutely no culling optimization in SFML, you must implement it yourself.
Title: Re: Culling in SFML's built-in classes
Post by: Conduit 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.