the ref parameter of glAlphaFuncx is fixed point, but when alpha compare
the alpha value from color is 8 bits, so the ref nust convert from fixed point to 8 bit, so must mapping [0…1] to [0… ff]
how to do this convert?
for example: fixed point 3300 convert to 8 bits value = 50 or 51??
The spec says that the fixed point value is converted to “an internal floating point format” by dividing the integer representing the 16.16 fixed point value by 2^16. However, it doesn’t say anything about the precision of that division or of the “internal floating point format” (which doesn’t really have to be floating point at all).
An accurate conversion is to take the clamped fixed point value, multiply it by 255, then round to nearest integer. Though you can save a bit of work by truncating the fractional part instead of rounding.