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

 

Vega Code Example

 

 

 

 

 

 
 

This example illustrates how to dump the of  vgObject:

  • How to get the number of defined vgObject's

  • How to get a pointer to a vgObject

  • How to get a pointer to the vgObject pfNode

  • How dump the vgObject to the console

  • How dump the  vgObject 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;

pfNode   *objNode   = NULL;

FILE     *file      = NULL;

int       num       = 0;

 

 

    //

    //  Print out the Object to stdout

    //

    object = vgGetObj(0);

 

    vgPrint( object );

 

 

    //

    //  Print out all the Objects to a file

    //

    num  = vgGetNumObj();

 

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

 

        object = vgGetObj(i);

 

        vgPrint( object );

        }

 

 

    //

    //  Print out an Object to a file

    //

    file = fopen("obj_0_Dump.txt");

 

    objNode = vgGetObjPfNode( object );

    

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

    

    fclose( file );

 

 

 

 

    //

    //  Print out All Objects to a file

    //

    file = fopen("objects_dump.txt");

 

    num  = vgGetNumObj();

 

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

 

        object  = vgGetObj( i );

 

        objNode = vgGetObjPfNode( object );

 

        fprintf( file, "vgObject ( %s)", vgGetName( object ));

    

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

 

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

 

        }

 

    fclose( file );

 

 

 

 

 
 
 

 

 

© Copyright 2004 Gordon Tomlinson  All Rights Reserved.

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