grDepthBufferFunction() specifies the function used to compare each rendered pixel’s depth value with the depth value present in the depth buffer. The comparison is performed only if depth testing is enabled with grDepthBufferMode(). The choice of depth buffer function is typically dependent upon the depth buffer mode currently active. The default comparison function is GR_CMP_LESS.
void grDepthBufferFunction( GrCmpFnc_t func )
The single argument, func, specifies the depth comparison function. Table Depth Buffering.1 lists the valid comparison functions and the conditions under which a pixel will “pass” the test and overwrite the pixel in the frame buffer and depth buffer.
Table Depth Buffering.1 The depth test.
The func argument to grDepthBufferFunction() can take on any of the values listed in the first column of the table below. The second column specifies the depth test and the third column describes the conditions under which an incoming pixel will “pass” the test and overwrite the appropriate location in the frame buffer and depth buffer.
if func is
|
the depth comparison is
|
and the pixel
|
GR_CMP_NEVER
|
FALSE
|
never passes
|
GR_CMP_LESS
|
depthnew < depthold
|
passes if the pixel’s depth value is less than the stored depth value
|
GR_CMP_EQUAL
|
depthnew = depthold
|
passes if the pixel’s depth value is equal to the stored depth value
|
GR_CMP_LEQUAL
|
depthnew £ depthold
|
passes if the pixel’s depth value is less than or equal to the stored depth value
|
GR_CMP_GREATER
|
depthnew > depthold
|
passes if the pixel’s depth value is greater than the stored depth value
|
GR_CMP_NOTEQUAL
|
depthnew ¹ depthold
|
passes if the pixel’s depth value is not equal to the stored depth value
|
GR_CMP_GEQUAL
|
depthnew ³ depthold
|
passes if the pixel’s depth value is greater than or equal to the stored depth value
|
GR_CMP_ALWAYS
|
TRUE
|
always passes
|
Share with your friends: |