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:

Chapter 5

53