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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.6. POLYGONS 243<br />

3.6.5 Depth Offset<br />

The depth values of all fragments generated by the rasterization of a polygon may<br />

be offset by a single value that is computed for that polygon. The function that<br />

determines this value is specified by calling<br />

void PolygonOffset( float factor, float units );<br />

factor scales the maximum depth slope of the polygon, and units scales an<br />

implementation-dependent constant that relates to the usable resolution of the<br />

depth buffer. The resulting values are summed to produce the polygon offset value.<br />

Both factor and units may be either positive or negative.<br />

The maximum depth slope m of a triangle is<br />

m =<br />

√ ( ) 2 ( ) 2 ∂zw ∂zw<br />

+<br />

(3.11)<br />

∂x w ∂y w<br />

where (x w , y w , z w ) is a point on the triangle. m may be approximated as<br />

{∣ ∣ ∣}<br />

∣∣∣ ∂z w ∣∣∣ m = max ,<br />

∂z w ∣∣∣<br />

∂x w<br />

∣ . (3.12)<br />

∂y w<br />

If the polygon has more than three vertices, one or more values of m may be used<br />

during rasterization. Each may take any value in the range [min,max], where min<br />

and max are the smallest and largest values obtained by evaluating equation 3.11<br />

or equation 3.12 for the triangles formed by all three-vertex combinations.<br />

The minimum resolvable difference r is an implementation-dependent parameter<br />

that depends on the depth buffer representation. It is the smallest difference in<br />

window coordinate z values that is guaranteed to remain distinct throughout polygon<br />

rasterization and in the depth buffer. All pairs of fragments generated by the<br />

rasterization of two polygons with otherwise identical vertices, but z w values that<br />

differ by r, will have distinct depth values.<br />

For fixed-point depth buffer representations, r is constant throughout the range<br />

of the entire depth buffer. For floating-point depth buffers, there is no single minimum<br />

resolvable difference. In this case, the minimum resolvable difference for a<br />

given polygon is dependent on the maximum exponent, e, in the range of z values<br />

spanned by the primitive. If n is the number of bits in the floating-point mantissa,<br />

the minimum resolvable difference, r, for the given primitive is defined as<br />

r = 2 e−n .<br />

If no depth buffer is present, r is undefined.<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!