Re: How to delete a graph?

New Message Reply Date view Thread view Subject view Author view

Max Waterman (maxw++at++sgi.com)
Tue, 29 Sep 1998 10:03:07 -0700


ate a DBASE call-back and register it in main() before your simulation loop :-

> pfDBaseFunc( DbaseCallBack );

and in this call-back make a pfBuffer :-

> static pfBuffer *buffer = NULL;
>
> if ( buffer == NULL )
> {
> buffer = pfNewBuffer();
> pfSelectBuffer(buffer);
> }
>

then, also in the DBASE call-back, when you want to delete a node :-

> pfBufferRemoveChild( scene, node ); /* effected in pfMergeBuffer */
> pfAsyncDelete( node ); /* effected in pfDBase */

and you should also load any new node in this call-back, for example :-

> node = pfdLoadFile(files[i]);
> pfBufferAddChild( scene, node );

When your done adding or deleting :-

>
> pfMergeBuffer();
> pfDBase();

Because you're paging stuff, you will encounter fragmentation in various places, including the shared arena. To relieve these symptoms, you should call :-

> /* search through 1000000 entries in the free block list before giving up and allocating more */
> amallopt( M_MXCHK, 1000000, pfGetSharedArena() );
> /* place free stuff at beginning of free list, so it's found more quickly */
> amallopt( M_FREEHD, 1, pfGetSharedArena() );

before your simulation loop in main().

You might want to fork off the Dbase procedure into it's own process. To do this, call :-

> pfMultiprocess( PFMP_FORK_DBASE );

before pfConfig() in main().

I hope this helps.

Max.

PS. Note that this does not delete the GL texture names, which could cause problems. To do that you will need to :-

1) make a DRAW call back function [2] and register it with pfChanTravFunc() [1]
2) at node deletion time, have the DBASE function
  a) construct a list of pfTextures with pfuMakeTexList() (or pfuMakeSceneTexList()),
  b) store that in memory shared between DBASE and DRAW,
  c) set a flag (also in that shared memory) to tell the DRAW to delete and wait for it to be reset
3) make the DRAW call back test the above flag on each iteration, and, when it's set,
  a) call pfDeleteGLHandle() on each pfTexture in the list
  b) reset the flag to let the DBASE continue.

[1] don't forget to call pfClearChan() and pfDraw() in the DRAW callback.
[2] it doesn't matter if you multiprocess the DRAW or not, you _should_ still do a DRAW call-back when doing OpenGL calls (which pfDeleteGLHandle() does).

> José María López wrote:
>
> Hi everybody,
> Does anyone know how to delete some nodes completely, including vertex,
> textures, and color coordinates? We need to do it in real time. What we wnat
> it's to load and unload dynamically entire subgraph for save memory.
> We have performer 2.2.2 and IRIX 6.5 in a Octane
>
> Thank you very much,
> Jose M. Lopez
>
> **********************************************************
> Jose M. Lopez
> Project Manager
> ESPELSA STC
> Acanto 22
> 28045 Madrid, Spain
> Phone: +34 1 527 02 15
> Fax: +34 1 530 10 25
> email: jmlopez++at++espelsa.es
> ***********************************************************

-- 
Max Waterman. mailto:maxw++at++sgi.com  "Get off me cheese! Get off! Get off!
PSE-GPS                             Grommit, Grommit! Go for him! Off!"

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Tue Sep 29 1998 - 10:03:15 PDT

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