programming hints

OpenGL performance hints

OpenGL performance hints

Hints provided in this section are intended to help improve your applications performance when using HP’s implementation of OpenGL.

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

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.

52

Chapter 5