From: faculaganymede (faculaganymede++at++yahoo.com)
Date: 03/07/2005 16:55:29
Sinan,
Here's some code that I used to reload texture to a
model. It basically traverses the model node, gets
texture pointer from the geostate and does a
tex->setImage(image_data...). image_data is the
texture image you want to use. Hope this helps.
-------------------------------------------------------------------------------
// Traverse the model node
...
if(node->isOfType(pfGeode::getClassType()))
{
geode = (pfGeode *) node;
for(i=0; i<geode->getNumGSets(); i++)
{
gset=geode->getGSet(i);
gstate=gset->getGState();
// Reload texture
tex=(pfTexture*)gstate->getAttr(PFSTATE_TEXTURE);
...
tex->setImage((uint*)image_data, comp, xsize,
ysize, zsize);
...
}//end of for(i=0; i<geode->getNumGSets()...
}//end of
if(node->isOfType(pfGeode::getClassType()))...
else if(node->isOfType(pfGroup::getClassType()))
{
pfGroup *group=(pfGroup *) node;
for(i=0; i<group->getNumChildren(); i++)
{
if((igPostLoader(group->getChild(i), sensor_num,
model_index_number))==0)
return 0;
}
}//end of else
if(node->isOfType(pfGroup::getClassType()))...
...
Thanks,
faculaganymede
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/
This archive was generated by hypermail 2b29 : Mon Mar 07 2005 - 16:55:35 PST