HP Workstation zx2000 HP OpenGL Implementation Guide for HP-UX 11.X (IPF versi - Page 18

visibility test extension, GL_VISIBILITY_TEST_HP is called after glDisableGL_VISIBILITY_TEST_HP

Page 18 highlights

overview of OpenGL visibility test extension The Visibility Test extension provides a way for an application to test whether or not a primitive or set of primitives are visible against the current contents of the depth buffer. "Visibile" in this context means that at least one pixel passes the depth test. This differs from previous Occlusion Culling extensions by allowing the programmer to provide memory for many different Visibility Test results to be returned at the same time. This feature can be used with the glNextVisibilityTestHP routine in conjunction with the glVisibilityBufferHP routine. With glVisibilityBufferHP, the programmer specifies a Boolean array in which to store the results of the visibility tests; a call to glNextVisibilityTestHP finishes the current test (eventually placing the results of the test in the current position of the array specified by glVisiblityBufferHP), and beginning the next test, whose results will be placed in the subsequent entry of the array. Visibility Testing is enabled by a call to glEnable(VISIBILITY_TEST_HP). Making this call to glEnable (if VISIBILITY_TEST_HP has not already been enabled) causes Visibility Testing to begin, and sets the result destination to be the first entry in the buffer specified by glVisibilityBufferHP. The glNextVisibilityTest function prototype is defined as: void glNextVisibilityTestHP( void ) The glVisibilityBufferHP function prototype is defined as: void glVisibilityBufferHP( GLSizei size, GLboolean *buffer, GLboolean wait_on_get) glVisibilityBuffer has three arguments: 'buffer', 'size' and 'wait_on_get'. 'buffer' is a pointer to an array of Boolean values, and 'size' indicates the size of the array. 'buffer' returns values of GL_TRUE or GL_FALSE for each Visibility Test issued. A Visibility Test begins when a call is made to glEnable(GL_VISIBILITY_TEST_HP), and ends when a call is made to either glDisable(GL_VISIBILITY_TEST_HP), or glNextVisibilityTestHP(). When all Visibility Tests have been performed, glDisable(GL_VISIBILITY_TEST_HP) should be called, followed by a call to glGet of GL_VISIBILITY_TEST_HP. Calling glGet causes the contents of 'buffer' to be up to date (based on the value of the 'wait_on_get' parameter, discussed below). A Visibility Test result of GL_TRUE indicates that some portion of the primitive(s) rendered during that test were visible. A value of GL_FALSE indicates that no portion of the primitive(s) rendered during the test was visible. The third parameter, 'wait_on_get', is intended to allow for potential optimizations during Visibility Tests. When Visibility Tests are made, there is often some amount of latency between the time the request is made and when the answer is available. Once a glGet of GL_VISIBILITY_TEST_HP is called after glDisable(GL_VISIBILITY_TEST_HP), there will usually be a short delay (perhaps as much as 50 microseconds) before the answer is available. If the application would prefer to wait until the Visibility Test results are available before proceeding, then a value of GL_TRUE should be specified for the 'wait_on_get' parameter. If, on the other hand, the application has some useful work to do during that time, a value of GL_FALSE can be specified for the 'wait_on_get' parameter, and glGet returns immediately. However, 'buffer' is not guaranteed to be defined until some time later. To check to see when the Visibility Test results are complete, the programmer can look at the data returned by a glGet of GL_VISIBILITY_TEST_HP. Two Boolean value are returned. The first indicates whether or not GL_VISIBILITY_TEST_HP is currently enabled. The second indicates if there are any test results pending. If there are no test results pending, the programmer may conclude that 'buffer' is up to date. 1-14 OpenGL implementation guide

  • 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

1–14
OpenGL implementation guide
overview of OpenGL
visibility test extension
The Visibility Test extension provides a way for an application to test whether or not a primitive
or set of primitives are visible against the current contents of the depth buffer. "Visibile" in this
context means that at least one pixel passes the depth test. This differs from previous Occlusion
Culling extensions by allowing the programmer to provide memory for many different Visibility
Test results to be returned at the same time. This feature can be used with the
glNextVisibilityTestHP routine in conjunction with the glVisibilityBufferHP routine.
With glVisibilityBufferHP, the programmer specifies a Boolean array in which to store the results
of the visibility tests; a call to glNextVisibilityTestHP finishes the current test (eventually placing
the results of the test in the current position of the array specified by glVisiblityBufferHP), and
beginning the next test, whose results will be placed in the subsequent entry of the array.
Visibility Testing is enabled by a call to glEnable(VISIBILITY_TEST_HP). Making this call to
glEnable (if VISIBILITY_TEST_HP has not already been enabled) causes Visibility Testing to
begin, and sets the result destination to be the first entry in the buffer specified by
glVisibilityBufferHP.
The glNextVisibilityTest function prototype is defined as:
void glNextVisibilityTestHP( void )
The glVisibilityBufferHP function prototype is defined as:
void glVisibilityBufferHP( GLSizei size, GLboolean *buffer,
GLboolean wait_on_get)
glVisibilityBuffer has three arguments: ‘buffer’, ‘size’ and ‘wait_on_get’. 'buffer' is a pointer to
an array of Boolean values, and 'size' indicates the size of the array. 'buffer' returns values of
GL_TRUE or GL_FALSE for each Visibility Test issued. A Visibility Test begins when a call is
made to glEnable(GL_VISIBILITY_TEST_HP), and ends when a call is made to either
glDisable(GL_VISIBILITY_TEST_HP), or glNextVisibilityTestHP(). When all Visibility Tests
have been performed, glDisable(GL_VISIBILITY_TEST_HP) should be called, followed by a
call to glGet of GL_VISIBILITY_TEST_HP. Calling glGet causes the contents of 'buffer' to be
up to date (based on the value of the 'wait_on_get' parameter, discussed below). A Visibility Test
result of GL_TRUE indicates that some portion of the primitive(s) rendered during that test were
visible. A value of GL_FALSE indicates that no portion of the primitive(s) rendered during the
test was visible.
The third parameter, 'wait_on_get', is intended to allow for potential optimizations during
Visibility Tests. When Visibility Tests are made, there is often some amount of latency between
the time the request is made and when the answer is available. Once a glGet of
GL_VISIBILITY_TEST_HP is called after glDisable(GL_VISIBILITY_TEST_HP), there will
usually be a short delay (perhaps as much as 50 microseconds) before the answer is available. If
the application would prefer to wait until the Visibility Test results are available before
proceeding, then a value of GL_TRUE should be specified for the 'wait_on_get' parameter. If, on
the other hand, the application has some useful work to do during that time, a value of
GL_FALSE can be specified for the 'wait_on_get' parameter, and glGet returns immediately.
However, 'buffer' is not guaranteed to be defined until some time later. To check to see when the
Visibility Test results are complete, the programmer can look at the data returned by a glGet of
GL_VISIBILITY_TEST_HP.
Two Boolean value are returned. The first indicates whether or not GL_VISIBILITY_TEST_HP
is currently enabled. The second indicates if there are any test results pending. If there are no test
results pending, the programmer may conclude that 'buffer' is up to date.