21.06.2014 Views

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.2. GL STATE 12<br />

exactly expressed in this representation, one value (-128 in the example) is outside<br />

the representable range, and must be clamped before use. This equation is used everywhere<br />

that signed normalized fixed-point values are converted to floating-point,<br />

including for all signed normalized fixed-point parameters in GL commands, such<br />

as vertex attribute values 1 , as well as for specifying texture or framebuffer values<br />

using signed normalized fixed-point.<br />

Conversion from Floating-Point to Normalized Fixed-Point<br />

The conversion from a floating-point value f to the corresponding unsigned normalized<br />

fixed-point value c is defined by first clamping f to the range [0, 1], then<br />

computing<br />

f ′ = f × (2 b − 1). (2.3)<br />

f ′ is then cast to an unsigned binary integer value with exactly b bits.<br />

The conversion from a floating-point value f to the corresponding signed normalized<br />

fixed-point value c is performed by clamping f to the range [−1, 1], then<br />

computing<br />

f ′ = f × (2 b−1 − 1). (2.4)<br />

After conversion, f ′ is then cast to a signed two’s-complement binary integer<br />

value with exactly b bits.<br />

This equation is used everywhere that floating-point values are converted to<br />

signed normalized fixed-point, including when querying floating-point state (see<br />

section 6) and returning integers 2 , as well as for specifying signed normalized texture<br />

or framebuffer values using floating-point.<br />

2.2 GL State<br />

The GL maintains considerable state. This document enumerates each state variable<br />

and describes how each variable can be changed. For purposes of discussion,<br />

state variables are categorized somewhat arbitrarily by their function. Although we<br />

1 This is a behavior change in <strong>OpenGL</strong> <strong>4.2</strong>. In previous versions, a different conversion for<br />

signed normalized values was used in which -128 mapped to -1.0, 1<strong>27</strong> mapped to 1.0, and 0.0 was<br />

not exactly representable.<br />

2 This is a behavior change in <strong>OpenGL</strong> <strong>4.2</strong>. In previous versions, a different conversion for<br />

signed normalized values was used in which -128 mapped to -1.0, 1<strong>27</strong> mapped to 1.0, and 0.0 was<br />

not exactly representable.<br />

<strong>OpenGL</strong> <strong>4.2</strong> (<strong>Compatibility</strong> <strong>Profile</strong>) - <strong>April</strong> <strong>27</strong>, <strong>2012</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!