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

GL_LINE_STRIP, draw array set extensions, benefits of glDrawArraySethp, using glDrawArraySethp

Page 55 highlights

Chapter 5 programming hints OpenGL performance hints draw array set extensions glDrawArraySethp is a Hewlett-Packard 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, etc., 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. The amount of performance benefit depends upon several factors, including the number of primitives in the set, the length of the primitives in the set, and maximum rendering speed of the graphics device. To achieve optimum glDrawArraySethp rendering performance, group as many primitives in each set as possible. using glDrawArraySethp: To use glDrawArraySethp, the current vertex array must be set and enabled. This is done using glNormalPointer, glVertexPointer, glEnableClientState, etc., or glInterleavedArrays. After the vertex array is established and enabled, glDrawArraySethp may be used. The C declaration of glDrawArraySethp is: void glDrawArraySethp(GLenum mode, const GLint* list, GLsizei count); where: 53

  • 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

programming hints
OpenGL performance hints
Chapter 5
53
draw array set extensions
glDrawArraySethp
is a Hewlett-Packard 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
, etc., 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.
The amount of performance benefit depends upon several factors,
including the number of primitives in the set, the length of the primitives
in the set, and maximum rendering speed of the graphics device.
To achieve optimum
glDrawArraySethp
rendering performance, group
as many primitives in each set as possible.
using glDrawArraySethp:
To use
glDrawArraySethp
, the current vertex
array must be set and enabled. This is done using
glNormalPointer
,
glVertexPointer
,
glEnableClientState
, etc., or
glInterleavedArrays
. After the vertex array is established and
enabled,
glDrawArraySethp
may be used.
The C declaration of
glDrawArraySethp
is:
void glDrawArraySethp(GLenum mode,
const GLint* list, GLsizei count);
where: