Name
APPLE_float_pixels
Name Strings
GL_APPLE_float_pixels
Contact
Geoff Stahl, Apple (gstahl 'at' apple.com)
Notice
Copyright Apple Corporation, 2003.
IP Status
Apple Proprietary.
Status
Shipping Mac OS X v10.2.3 (version 1.0)
Version
1.0
Number
??
Dependencies
Written based on the wording of the OpenGL 1.2.1 specification.
Overview
This extensions adds texture types, texture internal formats and color
buffers composed of both 32 bit and 16 floating point numbers. 16 bit
floats (half float) are very similar to the IEEE single-precision
floating-point standard, except that it has only 5 exponent bits and 10
mantissa bits. All floating point numbers are clamped to the limits of the
range representable by their respective format.
Specifically, APPLE_float_pixels adds four pieces of functionality to
OpenGL. First, it provides an HALF_APPLE texture type allowing clients to
pass textures in the half float format. Second, it adds 12 additional sized
internal formats to allow OpenGL to process and maintain texture data in the
requested format if possible. Next, it provides the COLOR_FLOAT_APPLE pixel
format to allow creation of floating point and half float color buffers.
Lastly, it provides an additional query to allow clients to verify that they
have a floating point color buffer.
The HALF_APPLE texture type allows clients to use source textures composed
of half float color components. This constant is use in the type parameter
in DrawPixels, ReadPixels and texturing commands with a corresponding GL
half data type, which corresponds to a 16 bit half float, and has no
special interpretation.
Clients can use the 12 additional (6 floating point and 6 half float) sized
internal texture formats to specify the mapping of R, G, B and A values to
texture components, as they would with any other sized internal texture
format. Note, as is the standard practice with OpenGL, implementations
should map the sized internal texture R, G, B and A values to internal
components with memory allocations as close as possible to those specified
in the sized internal format.
Floating point color buffers are created by specifying the appropriate color
floating point pixel format attribute for the windowing system API in use by
the client. Both 128 bit and 64 bit floating point color buffers can be
supported, the former with full 32 bit floating point components and the
latter with 16 bit half float components.
Additionally, clients can query to see if they have a floating point color
buffer using GetBooleanv with COLOR_FLOAT_APPLE as the get value. The
number of bits per color buffer component can be determined in the usual
manner.
Issues:
None
New Procedures and Functions
None
New Tokens
Accepted by the <type> parameters of DrawPixels, ReadPixels, TexImage1D,
TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, TexSubImage3D, and
GetTexImage:
HALF_APPLE 0x140B
Accepted by the <pname> GetBooleanv:
COLOR_FLOAT_APPLE 0x8A0F
Accepted by the <internalFormat> parameter of TexImage1D,
TexImage2D, and TexImage3D:
RGBA_FLOAT32_APPLE 0x8814
RGB_FLOAT32_APPLE 0x8815
ALPHA_FLOAT32_APPLE 0x8816
INTENSITY_FLOAT32_APPLE 0x8817
LUMINANCE_FLOAT32_APPLE 0x8818
LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819
RGBA_FLOAT16_APPLE 0x881A
RGB_FLOAT16_APPLE 0x881B
ALPHA_FLOAT16_APPLE 0x881C
INTENSITY_FLOAT16_APPLE 0x881D
LUMINANCE_FLOAT16_APPLE 0x881E
LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F
Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation)
Add a new Section 2.1.2, (p. 6):
2.1.2 16 Bit Floating-Point
A 16 bit floating-point number (half float) has 1 bit sign (s), 10 bit
mantissa (m), and 5 bit exponent (e) with -15 bias. Given s, m, and e the
following applies:
if (0 < e < 31)
(-1)^s * 2^(e - 15) * (1 + m / 2^10)
else if (m == 0)
(-1)^s * 0
else if (m != 0)
(-1)^s * 2^(-14) * (m / 2^10)
Depending on hardware support the follow definitions of INF (Infinity) and
NaN (Not a Number) conditions may also apply but are not required by this
specification:
if (e == 31 and m == 0)
(-1)^s * INF
if (e == 31 and m != 0)
NaN
INF is a special representation indicating numerical overflow, while NaN
is a special representation indicating the result of illegal arithmetic
operations, such as division by zero. Computation with half floats is
carried out with the same termination and interruption limitations as with
single or double precision numbers.
Additions to Table 2.2: GL data types. (p. 10):
GL Type Minimum Number of Bits Description
------- ---------------------- --------------------
half 16 Floating-point value
Additions to Chapter 3 of the OpenGL 1.2 Specification (Rasterization)
Change the first sentence of section 3.6.4, Unpacking subsection, to read
(p. 90):
Data are taken from host memory as a sequence of signed or unsigned bytes
(GL data types byte and ubyte), signed or unsigned short integers (GL data
types short and ushort), signed or unsigned integers (GL data types int
and uint), IEEE 16 bit half floats (GL data type half) or floating point
values (GL data type float).
Additions to table 3.5 (p. 91):
type Parameter Corresponding Special
Taken Name GL Data Type Interpretation
-------------- ------------- --------------
HALF_FLOAT half No
Additions to table 3.16 (p. 115):
Sized Base R G B A L I
Internal Format Internal Format bits bits bits bits bits bits
----------------------------- --------------- ---- ---- ---- ---- ---- ----
RGBA_FLOAT32_APPLE RGBA f32 f32 f32 f32
RGB_FLOAT32_APPLE RGB f32 f32 f32
ALPHA_FLOAT32_APPLE ALPHA f32
INTENSITY_FLOAT32_APPLE INTENSITY f32
LUMINANCE_FLOAT32_APPLE LUMINANCE f32
LUMINANCE_ALPHA_FLOAT32_APPLE LUMINANCE_ALPHA f32 f32
RGBA_FLOAT16_APPLE RGBA f16 f16 f16 f16
RGB_FLOAT16_APPLE RGB f16 f16 f16
ALPHA_FLOAT16_APPLE ALPHA f16
INTENSITY_FLOAT16_APPLE INTENSITY f16
LUMINANCE_FLOAT16_APPLE LUMINANCE f16
LUMINANCE_ALPHA_FLOAT16_APPLE LUMINANCE_ALPHA f16 f16
Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
Operations and the Frame Buffer)
Change the Final Conversion subsection of section 3.6.4, to read (p. 160):
For an index, if the type is not FLOAT or HALF_FLOAT, final conversion
consists of masking the index with the value given in Table 4.6; if the
type is FLOAT or HALF_FLOAT, then the integer index is converted to a GL
float or half data value.
For an RGBA color, components are clamped depending on the data type of
the buffer being read. For fixed-point buffers, each component is clamped
to [0,1]. For floating-point buffers, if <type> is not FLOAT or
HALF_FLOAT, each component is clamped to [0,1] if <type> is unsigned or
[-1,1] if <type> is signed and then converted according to Table 4.7.
Additions to table 4.7 (p. 161):
type Parameter GL Data Type Component Conversion Formula
-------------- ------------ ----------------------------
HALF_FLOAT half c = f
Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
None.
Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and
State Requests)
Errors
None.
New State
(table 6.25, p. 215)
Get value Type Get Cmnd Minimum Value Description Sec. Attribute
----------------- ---- ----------- ------------- --------------------------- ---- ---------
COLOR_FLOAT_APPLE B GetBooleanv - True if color buffers store 2.7 -
floating point components
Revision History
none yet
|