X Crashes applying ClipTex. to gsets in Scene-G.

New Message Reply Date view Thread view Subject view Author view

Joaquim Muchaxo (joaquim++at++rocketmail.com)
Thu, 7 May 1998 02:13:09 -0700 (PDT)


Hi,
I have a inventor file that I converted to pfb with
pfconv.
The file has gsets that may be used by multiple
LODs (ie one gset may be used by two LOD children)

I apply a cliptexture to all gsets in the scene-graph
successfully. However sometimes the aplication crashes
the X window manager.

I have removed the traversal that aplies the gstate
to every gset and it does not crash.
I have attached the source code. Would you help
me to debug it ?

Note: Neither of the versions in geoset_apply_geostate
(commented and uncommented) are crash free.

Best Regards,
Joaquim

---------------------------------------
void geoset_apply_geostate( pfGeoSet *GeoSet, pfGeoState *
gstate) {
/*
  pfGeoState *gs = pfGetGSetGState(GeoSet);
   
  if( !gs)
    printf("no gstate");
     
  if( pfGetGStateAttr(gs, PFSTATE_TEXTURE) == ct ) {
    printf("gstate already has a cliptexture");
    return;
  }
       
  pfGStateMode(gs, PFSTATE_ENTEXTURE, PF_ON);
  pfGStateAttr(gs, PFSTATE_TEXTURE, ct);
  pfGStateMode(gs, PFSTATE_ENLIGHTING, PF_ON);
*/

  pfGSetGState( GeoSet, NULL); /* to remove current
gstate*/
  pfGSetGState( GeoSet, (pfGeoState *)gstate );
}

void traverse_nodes( pfNode *node, process_node_fn todo,
      void *data) {
  int i, n;

  if (node == NULL || todo==NULL) {
    printf("traverse_nodes: node or 'to do' function is
NULL");
    return;
  }
  
  if( !todo( node, data) )
    return; /* prune traversal */

  if (pfIsOfType(node, pfGetGroupClassType())) {
   
    n = pfGetNumChildren((pfGroup *)node);
    for (i = 0; i < n; i++)
      traverse_nodes( pfGetChild( (pfGroup *)node, i),
todo, data );
  }
    /* other type, such as light, prune traversal */
}

main () {

    ct = pfdLoadClipTexture(ClipTexFileName);
    Shared->mpcliptex = pfNewMPClipTexture();

    pfMPClipTextureClipTexture(Shared->mpcliptex, ct);
    (void)pfuAddMPClipTextureToPipes(Shared->mpcliptex,
pfGetPipe(0), NULL);

......
/* set up geo state */
    GeoState = pfNewGState(arena);
    pfGStateMode(GeoState, PFSTATE_ENTEXTURE, PF_ON);
    pfGStateAttr(GeoState, PFSTATE_TEXTURE, ct);
    pfGStateMode(GeoState, PFSTATE_ENLIGHTING, PF_ON);

.......

if( TerrainFileName)
      Shared->terrain= pfdLoadFile( TerrainFileName );
       
  if( Shared->terrain) {
    pfAddChild(root, Shared->terrain);
    traverse_nodes( Shared->terrain, geode_apply_geostate,
        GeoState);
  }
......
}

===
Joaquim Muchaxo
ph:+(351-1)8318237
mobile:+(351+1)/(0)931-272387
-------------------------------------------------------------
IMERSIVA - Multimedia, Virtual Reality & Geograph. Info.
Sys.
http://www.imersiva.ch
mailto:info++at++imersiva.ch

_________________________________________________________
DO YOU YAHOO!?
Get your free ++at++yahoo.com address at http://mail.yahoo.com

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:22 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.