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

display list performance, geometric primitives, GL_COMPILE_AND_EXECUTE mode, draw array set extensions

Page 36 highlights

programming hints display list performance The topics covered here are areas where you can gain substantial improvements in program performance when using OpenGL display lists. Here is a list of the topics that are covered: ■ geometric primitives ■ GL_COMPILE_AND_EXECUTE mode ■ draw array set extensions ■ textures ■ state changes and their effects on display lists ■ regular primitive data geometric primitives Geometric primitives will typically be faster in a display list than by using immediate mode. Each display list should have numerous primitives to ensure good performance. As a general rule, larger primitives will be faster than smaller ones. Performance gains here can be dramatic. For example, it is possible that a single GL_TRIANGLES primitive with 20 or so triangles will render three times faster than 20 GL_TRIANGLES primitives with a single triangle in each one. GL_COMPILE_AND_EXECUTE mode Due to the pre-processing of the display list, and execution performance enhancements, creating a display list using the GL_COMPILE_AND_EXECUTE mode will reduce program performance. If you need to improve your programs performance, do not create a display list using the GL_COMPILE_AND_EXECUTE mode. You will find that it is easier and faster to create the display list using the GL_COMPILE mode, and then execute the list after it is created. draw array set extensions glDrawArraySetHP is a HP OpenGL 1.1 extension to vertex arrays which provides a high-speed mechanism for rendering multiple primitives. Use of glDrawArraySetHP will be easy for applications which currently store geometry in vertex arrays and use multiple calls to glDrawArrays for rendering primitives from the arrays. glDrawArraySetHP is especially useful when multiple connected primitives, such as GL_LINE_STRIP, GL_TRIANGLE_STRIP, and so on, are consecutively drawn from a vertex array. However all OpenGL primitive types are supported. Since only glDrawArray calls are made while rendering the vertex array set, primitive attributes, such as material colors, must be established for the entire array set or changed per vertex. If OpenGL library calls other than glDrawArrays are required during rendering the set to properly draw the array set, then glDrawArraySetHP is not appropriate. benefits of glDrawArraySetHP glDrawArrays and glDrawArraySetHP provide basically the same programmatic benefits, that is reduced function calls and less user code. Note that glDrawArraySetHP's major benefit is performance. glDrawArraySetHP provides from 10%-55% performance advantage over using glDrawArrays alone. 5-2 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–2
OpenGL implementation guide
programming hints
display list performance
The topics covered here are areas where you can gain substantial improvements in program
performance when using OpenGL display lists. Here is a list of the topics that are covered:
geometric primitives
GL_COMPILE_AND_EXECUTE mode
draw array set extensions
textures
state changes and their effects on display lists
regular primitive data
geometric primitives
Geometric primitives will typically be faster in a display list than by using immediate mode.
Each display list should have numerous primitives to ensure good performance. As a general
rule, larger primitives will be faster than smaller ones. Performance gains here can be dramatic.
For example, it is possible that a single
GL_TRIANGLES
primitive with 20 or so triangles will
render three times faster than 20
GL_TRIANGLES
primitives with a single triangle in each one.
GL_COMPILE_AND_EXECUTE mode
Due to the pre-processing of the display list, and execution performance enhancements, creating
a display list using the
GL_COMPILE_AND_EXECUTE
mode will reduce program performance.
If you need to improve your programs performance, do not create a display list using the
GL_COMPILE_AND_EXECUTE
mode. You will find that it is easier and faster to create the
display list using the
GL_COMPILE
mode, and then execute the list after it is created.
draw array set extensions
glDrawArraySetHP
is a HP OpenGL 1.1 extension to vertex arrays which provides a
high-speed mechanism for rendering multiple primitives. Use of
glDrawArraySetHP
will be
easy for applications which currently store geometry in vertex arrays and use multiple calls to
glDrawArrays
for rendering primitives from the arrays.
glDrawArraySetHP
is especially useful when multiple connected primitives, such as
GL_LINE_STRIP
,
GL_TRIANGLE_STRIP
, and so on, are consecutively drawn from a vertex
array. However all OpenGL primitive types are supported.
Since only
glDrawArray
calls are made while rendering the vertex array set, primitive
attributes, such as material colors, must be established for the entire array set or changed per
vertex. If OpenGL library calls other than
glDrawArrays
are required during rendering the set
to properly draw the array set, then
glDrawArraySetHP
is not appropriate.
benefits of glDrawArraySetHP
glDrawArrays
and
glDrawArraySetHP
provide basically the same programmatic
benefits, that is reduced function calls and less user code. Note that
glDrawArraySetHP’s
major benefit is performance.
glDrawArraySetHP
provides from 10%-55% performance
advantage over using
glDrawArrays
alone.