Hi all, new SFML member here!
First let me say SFML is pretty sweet!
I worked in the past with glut, OpenGL, DirectX, tiny bit of XNA, SDL, Ogre3d, Irrlicht and ms gdi; and by far SFML has been the most intuitive, fun and friction-less to integrate with!
With that said, there is something that always puzzled me about rendering libs that also apply to SFML: why or why do you always use bytes instead of floats to represent colors??
Note that this is not a feature request nor a rant, its a genuine question I want to understand
I'll explain better:
Bytes are obviously the most memory-efficient way to represent colors, and thus efficient when copied around (like moving an int). but that efficiency is cancelled out by the need to convert from byte to float before setting the vertices, so the only real advantage of bytes is memory (as far as I see).
RAM is a very cheap asset nowadays and I think float have many advantages over byte that justify the extra memory consumption:
1. floats are much better for math operations, and without the fear of wraparound happening. for example, lets say I want to make a color 20% brighter. think for a moment how you would implement that with bytes? OK now here's how it goes with floats: "color * Color(1.2f, 1.2f, 1.2f, 1.0f)". and if color above 1.0f is a problem you can easily clip it right before using it.
2. speaking of clipping, using floats has another great advantage - you can pass the shaders values outside the range of 0.0f - 1.0f to create special effects. for example why not setting the color of a sprite to (2.0f, 1.0f, 1.0f, 1.0f) to actually empathize the red component of the texture, even beyond the texture original color?
3. this might be personal opinion, but I find floats far more intuitive then bytes for a color.
So what I'm basically asking is this: what are the main advantages of using bytes instead of floats? why did you chose bytes for SFML? is this just an industry standard? what is your personal take on the subject?
PS I found this old post:
http://en.sfml-dev.org/forums/index.php?topic=9056.0So I'm not the only one
thanks!