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

Author Topic: Isn't sf::Color very slow?  (Read 1374 times)

0 Members and 1 Guest are viewing this topic.

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Isn't sf::Color very slow?
« on: October 16, 2011, 09:31:54 pm »
why not use 32 bit numbers?

Besides I noticed somewhere deep inside the engine a lot of division operations to convert between colors - ProcessVertex method in Renderer - isn't that slow? (sfml 2.0)

I haven't noticed any batching of primitives neither.

Can you point me to a place where I can take a look at the promised new graphics rendering engine?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Isn't sf::Color very slow?
« Reply #1 on: October 16, 2011, 09:52:36 pm »
What is slow? In a graphics framework, it is often the drawcalls which limit performance. There is usually no point in worrying about single divisions or object copies ;)

And in ProcessVertex(), divisions are of the kind x / 255.f with a constant operand. The compiler can even optimize it to a multiplication.

sf::Color would be user-unfriendly as a 32 bit number, because it would make the use of bitwise operators necessary for component-wise access. I guess SFML itself accesses the single components a lot. And even if there are four 1 byte POD members, the class as a whole is a 4 byte type and can be treated as such, when it comes to copies.

The new graphics API is discussed here.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: