Graphics Reference
In-Depth Information
Upon fetch, the three RGB values are derived from the texture using the
following equations:
R = R *2
G = G *2
B = B *2
(EXP - 15)
out
in
(EXP - 15)
out
in
(EXP - 15)
out
in
If the input texture is specified in 16-bit half-float or 32-bit float, then
the OpenGL ES implementation will automatically convert to the shared
exponent format. The conversion is done by first determining the
maximum color value:
MAX = max (R,G,B)
c
The shared exponent is then computed using the following formula:
EXP = max (-16, floor (log (MAX ))) +16
2
c
Finally, the 9-bit mantissa values for RGB are computed as follows:
(
)
(EXP -15 9)
+
R
=
floor R/(2
) 0.5
+
s
(
)
(EXP -15 9)
+
G floor G/(2
=
) 0.5
+
s
(
)
B
=
floor B/(2
(EXP -15 9)
+
) 0.5
+
s
An application could use these conversion formulas to derive the 5-bit EXP
and 9-bit RGB values from incoming data, or it can simply pass in the 16-bit
half-float or 32-bit float data to OpenGL ES and let it perform the conversion.
Table 9-8
Valid Shared Exponent Sized Internal Format Combinations for
glTexImage2D
internalFormat
format
type
Input Data
R
F
GL_RGB9_E5
GL_RGB
GL_UNSIGNED_
INT_5_9_9_9_
REV
9/9/9/ RGB with
shared 5-bit
exponent
X
GL_RGB9_E5
GL_RGB
GL_HALF_FLOAT 16/16/16 RGB
(half-float)
X
GL_RGB9_E5
GL_RGB
GL_FLOAT
32/32/32 RGB
(half-float)
X
 
 
Search WWH ::




Custom Search