PDA

View Full Version : Suggestion for next glsl: float2integer convertion with defined rounding behavoir



degasus
03-11-2014, 07:48 AM
My current application often has to convert from float to integers, but glsl seems to lack convertion functions with defined rounding behavoirs:

In fact, I'm asking for this ones:
genIType ifloor (genType)
genIType iround (genType)
genIType iceil (genType)

Of course, they could all be implemented by eg
#define iround(x) (ivec(round(x)))
but I guess there is a better way for the gpu to do so.