Eric Heft (eheft++at++dnaco.net)
Wed, 16 Apr 1997 14:17:17 -0400 (EDT)
I've got a simple object built with gview. I want to change the
color of the object on the fly. I followed the sugestions offerered
in the achives and I think I've get everything right, but the pfSwitch
doesn't seem to be switching so I must have missed something :)
I'm using perfly as a baseline and added a call to incSwitch inside
the keybrd handler. findSwitch is called before entering the main
while (!ViewState->exitFlag) loop.
Thanks for any light you can shed on the subject.
Eric
void findSwitch(pfNode *node) /* Called from main.c */
{
if (pfIsOfType(node,pfGetSwitchClassType()))
{
ViewState->colorSwitch = node;
printf(" Found Switch node \n");
}
if (pfIsOfType(node,pfGetGroupClassType()))
{
int i;
for (i=0; i<pfGetNumChildren(node); i++)
{
findSwitch(pfGetChild(node,i));
}
}
}
void incSwitch(void) /* Called from processKeybdInput */
{
static int var = 0;
var = (var+1) % 3;
printf("Setting switch val to %d\n",var);
pfSwitchVal(ViewState->colorSwitch,var);
}
#Inventor V2.1 ascii
Separator {
PickStyle {
style UNPICKABLE
}
LightModel {
model BASE_COLOR
}
NormalBinding {
value PER_VERTEX_INDEXED
}
Switch {
whichChild 0
BaseColor {
rgb 0.8 1 0.2
}
BaseColor {
rgb 0 0 0
}
BaseColor {
rgb 1 0 0
}
BaseColor {
rgb 0 1 0
}
}
Coordinate3 {
point [ -10 0 0,
10 0 0,
0 -10 0,
0 10 0 ]
}
LineSet {
numVertices [ 2, 2 ]
}
}
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:04 PDT