hello ladies and gentlemen ,
i’ve picked up the topic “openGL for games”
and now i have a general suggestion:
why float32’s are used for the most frequent functions in openGL?!
and not int32
the points i thought about are
-
games often do NOT use the full range that float32’s have , most of the time the player moves in a cube wich less side-size than about 500000.0000 units , wich fits perfectly in one integer including the fraction part of four digits.
-
the floats must anyway be convertet into screencoordinates , wich are obviously integers.
i think the conversion overhead could be avoided using integers. -
taking this a bit further and including SIMD instructions , it is even way to expensive using float32’s in matrice operations , because normalized vectors have only a range of +/- 1.0000 (excluding the translation and scale part).
-
including special functions , like quaternion rotations (based on a vector by vector computation ) etc ,… would also speed up many things.
-
the only problem i see by now(and by my state of knowledge) is the d3d layer on wich openGL resides
but that would only need a tip to microsoft and their d3d quiz (ehem) api. -
i dont think that the performance hit caused by
float math is neglegable(not even by microsoft) , when i compare the instruction latencys.
so in my opinion games definetly need special version of openGL wich uses integral math and has some specialized functions , because the people playing the products made with openGL are the ones that keep openGL alive and they need faster games.
i am often confronted with people that rely on the logic that the only thing that must change in order to make an algorithm faster is the hardware on wich it runs.This logic is like bending a road just because they want to steer.
Often this people do not have the mind and/or just don’t want to have a basic understanding of the assembly level , but i think the developers of openGL and d3d have a strong knowledge of assembly.And that makes me even more curious to get to know why they didn’t adopt a version of openGL/d3d to the needs that games have.