A SERVICE OF

logo

Performance Programming Techniques
163
Performance Programming Techniques
The following sections provide programming tips for improving the performance of
your application:
•“Minimize Use of csAppearance Fields on page 163.
•“Minimize Use of csAppearance Modes on page 163.
•“Indexing csGeoSet Attributes on page 164.
•“Setting the Transformation Matrix Directly on page 164.
•“Compiling Part of a Scene Graph on page 164.
Minimize Use of csAppearance Fields
Many of the elds in csContext set the appearance of a geometry. The elds in
csAppearance match those in csContext. Setting a csAppearance eld overrides the
values of the same elds set in csContext. Overriding csContext values, however,
reduces performance because the eld has to be reevaluated every time the
csAppearance object is applied.
To maximize performance:
Set csContext elds to values that satisfy a majority of the shapes in a scene.
Set the inherit eld in csAppearance to inherit, not apply, those elds.
In this way, you set the minimum number of csAppearance elds.
Minimize Use of csAppearance Modes
Some of the elds set in csAppearance are much more graphics-intensive than others. In
particular, the blending, texture, and lighting elds require larger amounts of CPU time.
To improve performance, it is better not to turn on these modes if your application does
not need them.