10- and 11-bit Unsigned Floating-Point Values

For normalized color values in the range [0, 1], unsigned 10- and 11-bit floating-point formats may provide a more compact format with better dynamic range than either floating-point values, or OpenGL’s unsigned integer pixel formats. The maximum representable values are 65204 and 64512, respectively.

Routines for converting floating-point values into 10-bit unsigned floating-point values, and vice versa, are shown below.

#define UF11_EXPONENT_BIAS  15#define UF11_EXPONENT_BITS  0x1F#define UF11_EXPONENT_SHIFT 6#define UF11_MANTISSA_BITS  0x3F#define UF11_MANTISSA_SHIFT (23 - UF11_EXPONENT_SHIFT)#define UF11_MAX_EXPONENT \  (UF11_EXPONENT_BITS << UF11_EXPONENT_SHIFT) ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.