A SERVICE OF

logo

40
Chapter 3: Specifying the Appearance of Geometries
In this example, the second context replaces the rst.
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 elds dene the appearance of a csGeometry object, for example, its
texture, material, or color. All of the elds in csAppearance are replicated in csContext.
Inheriting Appearance Values
To specify the appearance of a csGeometry, you can either
Set all of the appearance elds in a csAppearance object.
Use the inherited, global, default values from the current context, csContext.
Use a combination of the rst two options.
If you set all of the elds of an appearance object, the appearance object becomes the full
graphic context of the csShape. The more appearance elds you set, however, the slower
the applications 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 elds are set on
a per-shape basis.
Setting Appearance Fields Locally
The only elds that you should set locally are those that change often, such as the eld
values for material and texture. Changing a eld value locally overrides any value
inherited from csContext.