Problem with SoMaterial and SoCallbackAction

Problem with SoMaterial and SoCallbackAction

Post by dj » Thu, 10 Apr 2003 10:56:07



Hi,

    I am using TGS OpenInventor 3.0, win32 version, and find out a strange
problem as following:

    I register my callback routine via
"addPostCallback(SoMaterial::getClassTypeId(),_MaterialCB,pAct)". Within the
_MaterialCB,I query the transparency value by
SoCallbackAction::getMaterial():

   ... _MaterialCB(...){
      ...
      float trans;
      pAct->getMaterial(...,trans,0);
      ...
   }

The problem is: When SoCallbackAction traversing a scenegraph with two
cascading SoMaterial nodes,  if the second material's transparency is ZERO,
it does not get a correct ZERO value, instead the previous material's
transparency is returned. If I set the second material's transparency to
0.00001, a very little value, then it does return a 0.00001.   Other fields
of SoMaterial have not such a problem.

-------Sample scenegraph:--------
#Inventor V2.1 ascii

 Separator {

#First material
  Material {
  diffuseColor 0 0.501961 1
  transparency 0.4
  }
  Sphere {
  radius 1.3
  }

#Second material
  Material {
  diffuseColor 0.501961 1 0.501961
  transparency 0  //Problem!
  }
  Cube {
  }

Quote:}

   Any suggestions?

Thanks.

D.J.
2003/4/9

 
 
 

1. Why change SoMaterial node?

Can anyone tell me why the ambientColor, specularColor, emissiveColor
and shininess fields in the SoMaterial node have been changed in
version 2.1 so that they no longer support multiple values? I can't
see any obvious reason to do that, unless it somehow affords a
worthwhile speed increase...

Rikk Carey? Gavin Bell? Paul Strauss? Anyone?

Cheers,

James

2. monzoom pro Homepage

3. transparency can NOT be overridden in SoMaterial?

4. Shipping Products for the Power Macintosh (2/3/95) 2 of 3

5. Question about SoMaterial fields physical meaning.

6. Trident + Deluxe Paint

7. Ignoring material colors during an SoCallbackAction

8. FREE TIPS & TRICKS FOR PAGEMAKER

9. Another SoCallbackAction question

10. Texture filename during SoCallbackAction

11. SoCallbackAction

12. SoCallBackAction::addTriangleCallback()

13. Strange Triangles From SoCallbackAction