Mario Veraart (rioj7++at++fel.tno.nl)
Wed, 2 Sep 1998 22:41:12 MET-1DST
I have an application in which I want to toggle some state elements
on a per window/channel basis. They are wireframe and texture.
In the draw callback I use te following code
static void DrawFunc (pfChannel *chan, void *data)
{
PreDraw (chan, data);
pfDraw ();
PostDraw (chan, data);
}
static void PreDraw (pfChannel *chan, void *data) {
pfClearChan (chan);
....
if (chandata->texture)
pfEnable(PFEN_TEXTURE);
else
pfDisable(PFEN_TEXTURE);
if (chandata->wireframe)
pfEnable(PFEN_WIREFRAME);
else
pfDisable(PFEN_WIREFRAME);
pfOverride (PFSTATE_ENTEXTURE |
PFSTATE_ENWIREFRAME, PF_ON);
}
static void PostDraw (pfChannel *chan, void *data)
{
/* release the overrides so the next window can set them */
pfOverride (PFSTATE_ENTEXTURE |
PFSTATE_ENWIREFRAME, PF_OFF);
}
Then I can set texture on/off on a per window basis but the
wireframe is on or off in both windows.
If I change the draw callback to
static void DrawFunc (pfChannel *chan, void *data)
{
pfPushState();
PreDraw (chan, data);
pfDraw ();
PostDraw (chan, data);
pfPopState();
}
Then I can set wireframe on a per window basis.
Why do I need the push and pop of the performer state?
I use performer 2.0.4.
Mario
This archive was generated by hypermail 2.0b2 on Wed Sep 02 1998 - 13:42:14 PDT