21.06.2014 Views

OpenGL 4.1 (Compatibility Profile) - July 25, 2010

OpenGL 4.1 (Compatibility Profile) - July 25, 2010

OpenGL 4.1 (Compatibility Profile) - July 25, 2010

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.

<strong>4.1</strong>. PER-FRAGMENT OPERATIONS 358<br />

functions are both ALWAYS, and the front and back stencil mask are both set to the<br />

value 2 s − 1, where s is greater than or equal to the number of bits in the deepest<br />

stencil buffer supported by the GL implementation. Initially, all three front and<br />

back stencil operations are KEEP.<br />

If there is no stencil buffer, no stencil modification can occur, and it is as if the<br />

stencil tests always pass, regardless of any calls to StencilFunc.<br />

<strong>4.1</strong>.6 Depth Buffer Test<br />

The depth buffer test discards the incoming fragment if a depth comparison fails.<br />

The comparison is enabled or disabled with the generic Enable and Disable commands<br />

using the symbolic constant DEPTH_TEST. When disabled, the depth comparison<br />

and subsequent possible updates to the depth buffer value are bypassed and<br />

the fragment is passed to the next operation. The stencil value, however, is modified<br />

as indicated below as if the depth buffer test passed. If enabled, the comparison<br />

takes place and the depth buffer and stencil value may subsequently be modified.<br />

The comparison is specified with<br />

void DepthFunc( enum func );<br />

This command takes a single symbolic constant: one of NEVER, ALWAYS, LESS,<br />

LEQUAL, EQUAL, GREATER, GEQUAL, NOTEQUAL. Accordingly, the depth buffer<br />

test passes never, always, if the incoming fragment’s z w value is less than, less<br />

than or equal to, equal to, greater than, greater than or equal to, or not equal to<br />

the depth value stored at the location given by the incoming fragment’s (x w , y w )<br />

coordinates.<br />

If depth clamping (see section 2.23) is enabled, before the incoming fragment’s<br />

z w is compared z w is clamped to the range [min(n, f), max(n, f)], where n and f<br />

are the current near and far depth range values (see section 2.17.1)<br />

If the depth buffer test fails, the incoming fragment is discarded. The stencil<br />

value at the fragment’s (x w , y w ) coordinates is updated according to the function<br />

currently in effect for depth buffer test failure. Otherwise, the fragment continues<br />

to the next operation and the value of the depth buffer at the fragment’s (x w , y w )<br />

location is set to the fragment’s z w value. In this case the stencil value is updated<br />

according to the function currently in effect for depth buffer test success.<br />

The necessary state is an eight-valued integer and a single bit indicating<br />

whether depth buffering is enabled or disabled. In the initial state the function<br />

is LESS and the test is disabled.<br />

If there is no depth buffer, it is as if the depth buffer test always passes.<br />

<strong>OpenGL</strong> <strong>4.1</strong> (<strong>Compatibility</strong> <strong>Profile</strong>) - <strong>July</strong> <strong>25</strong>, <strong>2010</strong>

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

Saved successfully!

Ooh no, something went wrong!