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

optimization of lighting, occlusion culling, high frame rate applications, glBegin/glEnd

Page 40 highlights

programming hints These calls cannot occur between a glBegin/glEnd pair. Examples of such commands are: glEnable(GL_LIGHTING); glFogf(GL_FOG_MODE, GL_LINEAR); glLightf(..); glLoadMatrixf(..); Changes to the modal state are significantly more expensive to process than simple vertex-data commands. Also, application performance can be optimized by grouping modal-state changes, and by minimizing the number of modal-state changes: ■ Grouping your state changes together (that is, several modal state changes at one time), and then rendering primitives, will provide better performance than doing the modal state changes one by one and intermixing them with primitives. ■ Grouping primitives that require the same modal state together to minimize modal state changes. For example, if only part of a scene's primitives are lighted, draw all the lighted primitives, then turn off lighting and draw all the unlighted primitives, rather than enabling/disabling lighting many times. Some states negatively impact performance, such as two-sided lighting, polygon mode GL_LINE, and wide lines. optimization of lighting HP's implementation of OpenGL optimizes the lighting case such that the performance degradation from one light to two or more lights is linear. Lighting performance does not degrade noticeably when you enable a second light. In addition, the GL_SHININESS material parameter is not particularly expensive to change. occlusion culling The proper use of HP's occlusion culling extension can dramatically improve rendering performance. This extension defines a mechanism for determining the non-visibility of complex geometry based on the non-visibility of a bounding geometry. This feature can greatly reduce the amount of geometry processing and rendering required by an application, thereby, increasing the applications performance. For more information on occlusion culling, see the section "occlusion extension" on page 1-12. high frame rate applications To achieve maximum performance for buffer swap and clear operations, avoid the following: ■ depth 8 visuals ■ stereo 5-6 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

5–6
OpenGL implementation guide
programming hints
These calls cannot occur between a
glBegin/glEnd
pair. Examples of such commands are:
glEnable(GL_LIGHTING);
glFogf(GL_FOG_MODE, GL_LINEAR);
glLightf(..);
glLoadMatrixf(..);
Changes to the modal state are significantly more expensive to process than simple vertex-data
commands. Also, application performance can be optimized by grouping modal-state changes,
and by minimizing the number of modal-state changes:
Grouping your state changes together (that is, several modal state changes at one time), and
then rendering primitives, will provide better performance than doing the modal state
changes one by one and intermixing them with primitives.
Grouping primitives that require the same modal state together to minimize modal state
changes. For example, if only part of a scene’s primitives are lighted, draw all the lighted
primitives, then turn off lighting and draw all the unlighted primitives, rather than
enabling/disabling lighting many times.
Some states negatively impact performance, such as two-sided lighting, polygon mode
GL_LINE
, and wide lines.
optimization of lighting
HP’s implementation of OpenGL optimizes the lighting case such that the performance
degradation from one light to two or more lights is linear. Lighting performance does not degrade
noticeably when you enable a second light. In addition, the
GL_SHININESS
material parameter
is not particularly expensive to change.
occlusion culling
The proper use of HP’s occlusion culling extension can dramatically improve rendering
performance. This extension defines a mechanism for determining the non-visibility of complex
geometry based on the non-visibility of a bounding geometry. This feature can greatly reduce the
amount of geometry processing and rendering required by an application, thereby, increasing the
applications performance. For more information on occlusion culling, see the section
“occlusion
extension” on page 1-12
.
high frame rate applications
To achieve maximum performance for buffer swap and clear operations, avoid the following:
depth 8 visuals
stereo