40
Chapter 3: Specifying the Appearance of Geometries
In this example, the second context replaces the first.
• display is a pointer to the X window display.
• window is the GLXDrawable in which the scene is displayed.
getCurrent() returns the context object on top of the context stack.
csWindow has a context and calls makeCurrent() automatically.
Using csAppearance
csAppearance fields define the appearance of a csGeometry object, for example, its
texture, material, or color. All of the fields in csAppearance are replicated in csContext.
Inheriting Appearance Values
To specify the appearance of a csGeometry, you can either
• Set all of the appearance fields in a csAppearance object.
• Use the inherited, global, default values from the current context, csContext.
• Use a combination of the first two options.
If you set all of the fields of an appearance object, the appearance object becomes the full
graphic context of the csShape. The more appearance fields you set, however, the slower
the application’s performance because you are triggering lots of state changes.
For maximum performance, set the appearance values in csContext to satisfy the
maximum number of shapes so that the fewest number of csAppearance fields are set on
a per-shape basis.
Setting Appearance Fields Locally
The only fields that you should set locally are those that change often, such as the field
values for material and texture. Changing a field value locally overrides any value
inherited from csContext.