HP j6700 OpenGL Implementation Guide for HP-UX 11.x - Page 21

OpenGL extensions, visibility test extensions

Page 21 highlights

Chapter 1 overview of OpenGL OpenGL extensions OpenGL extensions The extensions listed in this section are extensions that Hewlett-Packard has created; that is, in addition to those standard functions described in the OpenGL Programming Guide, OpenGL Reference Manual, and OpenGL Programming for the X Window System. visibility test extensions HP supports extensions for visibility testing and occlusion culling. See the on-line Reference Manual for information on HP's visibility test extensions, glVisibilityBufferHP and glNextVisibilityTestHP. occlusion extension This occlusion culling extension defines a mechanism whereby an application can determine the non-visibility of some set of geometry based on whether an encompassing set of geometry is non-visible. In general, this feature does not guarantee that the target geometry is visible when the test fails, but is accurate with regard to non-visibility. Typical usage of this feature would include testing the bounding boxes of complex objects for visibility. If the bounding box is not visible, then it is known that the object is not visible and need not be rendered. occlusion culling code fragments The following is a sample code segment that shows a simple usage of occlusion culling. /* Turn off writes to depth and color buffers */ glDepthMask(GL_FALSE); glColorMask (GL_FALSE, GL_FALSE, GL_FALSE); /* Enable Occlusion Culling test */ glEnable(GL_OCCLUSION_TEST_HP); for (i=0; i < numParts; i++) { /* Render your favorite bounding box */ renderBoundingBox(i); /* If bounding box is visible, render part */ glGetBooleanv(GL_OCCLUSION_RESULT_HP, &result); 19

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62

overview of OpenGL
OpenGL extensions
Chapter 1
19
OpenGL extensions
The extensions listed in this section are extensions that Hewlett-Packard
has created; that is, in addition to those standard functions described in
the
OpenGL Programming Guide
,
OpenGL Reference Manual
, and
OpenGL Programming for the X Window System
.
visibility test extensions
HP supports extensions for visibility testing and occlusion culling.
See the on-line
Reference Manual
for information on HP’s visibility test
extensions,
glVisibilityBufferHP
and
glNextVisibilityTestHP
.
occlusion extension
This occlusion culling extension defines a mechanism whereby an
application can determine the non-visibility of some set of geometry
based on whether an encompassing set of geometry is non-visible. In
general, this feature does not guarantee that the target geometry is
visible when the test fails, but is accurate with regard to non-visibility.
Typical usage of this feature would include testing the bounding boxes of
complex objects for visibility. If the bounding box is not visible, then it is
known that the object is not visible and need not be rendered.
occlusion culling code fragments
The following is a sample code segment that shows a simple usage of
occlusion culling.
/* Turn off writes to depth and color buffers */
glDepthMask(GL_FALSE);
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE);
/* Enable Occlusion Culling test */
glEnable(GL_OCCLUSION_TEST_HP);
for (i=0; i < numParts; i++) {
/* Render your favorite bounding box */
renderBoundingBox(i);
/* If bounding box is visible, render part */
glGetBooleanv(GL_OCCLUSION_RESULT_HP, &result);