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


Vega Code Example







This example illustrates how to dump the contents of a vgScene:

  • How to get the number of defined vgScene's

  • How to get a pointer to a vgScene

  • How to get a pointer to the vgScene pfNode

  • How dump the vgScene to the console

  • How dump the  vgScene 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"



vgScene  *scene     = NULL;

pfNode   *sceneNode = NULL;

FILE     *file      = NULL;

int       num       = 0;



    file = fopen("scenesDump.txt");


        num = vgGetNumScene();


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



        //  Print out the whole Scene to a file



        scene     = vgGetScene(i);     


        sceneNode = vgGetScenePfScene( scene );


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



    fclose( file );




    //  Print out the Scene to stdout (you could redirect stdout to a file)


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


        scene = vgGetScene(i);     


        vgPrint( scene );







Copyright 2004 Gordon Tomlinson  All Rights Reserved.

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