How to Display/Dump/Print  a vgPart to a File

 

Vega Code Example

 

 

 

 

 

 

 
 

This example illustrates how to dump the of  vgPart:

  • How to get the number of defined vgPart's

  • How to get a pointer to a vgPart

  • How to get a pointer to the vgPart pfNode

  • How dump the vgPart to the console

  • How dump the  vgPart to the file

  • How to use vgPrint

  • How to use pfPrint

 

 

 
   
 

 

 
 
 
 

                      


                

#include <stdlib.h>       //  definition of printf                

#include "vg.h"           //  main include file for Vega         

#include "vgperf.h"       //  for the Vega Performer node functions

#include "vgutil.h"

#include "pf.h"           //  main include file for Performer    

#include "pfutil.h"

 

 

vgObject *object   = NULL;

vgPart   *part     = NULL;

pfNode   *partNode = NULL;

FILE     *file     = NULL;

int       num      = 0;

 

 

  

    //

    // Print out an Part to a file

    //

    file = fopen("part_0_dump.txt");

 

    object = vgGetObj( 0 );

 

    part = vgGetPart( object, 0 );

 

    partNode = vgGetPartPfNode( part );

    

    pfPrint( partNode, PFTRAV_SELF | PFTRAV_DESCEND, PFPRINT_VB_DEBUG, file );

    

    fclose( file );

 

 

 

    //

    // Print out all Parts of an object to a file

    //

    file = fopen("parts_dump.txt");

 

    object = vgGetObj( 0 );

  

    num  = vgGetNumParts( object );

   

    for( int i = 0; i < num; i++ ){

 

         part = vgGetPart( object, i );

   

         partNode = vgGetPartPfNode( part );

 

         fprintf( file, "vgPart ( %s)", vgGetName( part ));

    

         pfPrint( partNode,PFTRAV_SELF | PFTRAV_DESCEND,PFPRINT_VB_DEBUG, file );

 

         fprintf( file, "-------------------\n\n");

        }

 

        

    fclose( file );

        

 

 

    //

    //  Print out the Part to stdout

    //

    object = vgGetObj( 0 );

    part   = vgGetPart( object, 0 );

    vgPrint( ( vgGetPart( part );

 

 

    //

    //  Print out the all Part of an object to stdout

    //

 

    object = vgGetObj( 0 );

  

    num    = vgGetNumParts( object );

   

    for( int i = 0; i < num; i++ ){

 

         part = vgGetPart( object, i );

   

         vgPrint( part );

 

        }

 

 
 
 

 

 

 

Copyright 2004 Gordon Tomlinson  All Rights Reserved.

All logos, trademarks and copyrights in this site are property of their respective owner.