overview of OpenGL

OpenGL extensions

 

if (result) {

 

 

glColorMask(GL_TRUE, GL_TRUE, GL_TRUE);

 

glDepthMask(GL_TRUE);

 

 

renderPart(i);

 

 

glDepthMask(GL_FALSE);

 

 

glColorMask (GL_FALSE, GL_FALSE, GL_FALSE);

 

}

 

 

}

 

 

/* Disable Occlusion Culling test */

 

 

glDisable(GL_OCCLUSION_TEST_HP);

 

 

/* Turn on writes to depth and color buffers */

 

glColorMask(GL_TRUE, GL_TRUE, GL_TRUE);

 

glDepthMask(GL_TRUE);

 

 

The key idea behind occlusion culling is that the bounding box is much

 

simpler (i.e., fewer vertices) than the part itself. Occlusion culling

 

provides a quick means to test non-visibility of a part by testing its

 

bounding box.

 

 

 

It should also be noted that this occlusion culling functionality is very

 

useful for viewing frustum culling. If a part’s bounding box is not visible

 

for any reason (not just because it’s occluded in the Z-buffer) this test will

 

give correct results.

 

 

To maximize the probability that an object is occluded by other objects in

 

a scene, the database should be sorted and rendered from front to back.

 

Also, the database may be sorted hierarchically such that the outer

 

objects are rendered first and the inner are rendered last. An example

 

would be rendering the body of an automobile first and the engine and

 

transmission last. In this way, the engine would not be rendered due to

 

the bounding box test indicating that the engine is not visible.

Table 1-9

Enumerated Types for Occlusion

 

 

 

 

 

Extended Area

 

Enumerated Type

Description

 

 

 

Enable.Disable/IsEnabled

GL_OCCLUSION_TEST_HP

pname variable.

 

 

Default: Disabled

 

 

 

 

 

Get*

 

GL_OCCLUSION_TEST_RESULT_HP

pname variable

 

 

Default: Zero (0)

 

 

 

 

 

 

For related information, see the functions: glGet, glEnable, glDisable,

 

and glIsEnabled.

 

20

Chapter 1

Page 22
Image 22
HP c8000 manual Enumerated Types for Occlusion