Performer Notice: Caught SIGCHLD. Exiting due to death of child with pid 1680.

New Message Reply Date view Thread view Subject view Author view

Tawfek Mukhtar (tawfek++at++media1.rndtm.com.my)
Sun, 17 Mar 1996 15:16:57 -0800


I am trying to write a very short program that is composed of two objects.
One of it will orbit the other object.
Initially the view will be at x = 0, y = -10 z =0 and h = 0,p=0,r=0.
I would like to implement the capability of changing the view such that if I
press a key than I will be able to see the static object from the perspective
of the orbiting object.
Anyway the program compile fine but every time I tried to change the view I
got
"Performer Notice: Caught SIGCHLD. Exiting due to death of child with pid
1680."
I have included the program with this mail. Can anyone help me with this ?

Thanks

#include <X11/Xlib.h>

#include <math.h>
#include <Performer/pf.h>

#include "pfsgi.h"
#include "pfutil.h"

static void openPipeline(pfPipe * pipe);
static void processInput(void);
static void drawFrame(pfChannel * chan, void * data);
void changeView(void);

typedef struct
{
  pfCoord currentView;
  pfCoord orbitingView;
  int dynamicView;
} SharedData;

SharedData * shared;

pfuEvent events;
int quit = 0;
float header = 0.0f;
float orbitRadius = 8.0f;
static int dynamicView = 0;
pfSCS * objectPosInOrbit;
pfDCS * orbitRot;

int main(void)
{
    pfScene * scene;
    pfNode * object;
    pfNode * rotatingObject;
    pfMatrix matrix;
    pfCoord initView;
    
    pfPipe * pipe;
     
    pfChannel * channel;
    float time;
    float maxTime;
    void * arena;
     
     
    pfInit();
    arena = pfGetSharedArena();
    shared = (SharedData *)pfMalloc(sizeof(SharedData), arena);
    pfConfig();
    pfuInitUtil();
     
      
    pipe = pfGetPipe(0);
    channel = pfNewChan(pipe);
    pfChanDrawFunc(channel, drawFrame);
    pfuInitInput(pipe, PFUINPUT_X);
     
    pfInitPipe(pipe, openPipeline);
     
    object = LoadFile("tree.flt", NULL);
    /*
     * so tree will be at the center of the scene
     */
    scene = pfNewScene();
    pfAddChild(scene, object);
     
    /*
     * we are going to make an object that will orbit the tree
     */
    rotatingObject = LoadFile("box.flt", NULL);
    pfMakeTransMat(matrix, orbitRadius, 0.0f, 0.0f);
    objectPosInOrbit = pfNewSCS(matrix);
    pfAddChild(objectPosInOrbit, rotatingObject);
    orbitRot = pfNewDCS();
    pfAddChild(orbitRot, objectPosInOrbit);
    pfAddChild(scene, orbitRot);
    pfSetVec3(initView.xyz,0.0f, -10.0f, 0.0f);
    pfSetVec3(initView.hpr, 0.0f, 0.0f, 0.0f);
    pfCopyVec3(shared->currentView.xyz, initView.xyz);
    pfCopyVec3(shared->currentView.hpr, initView.hpr);
    pfChanFOV(channel, 60.0f, 60.0f);
    pfChanScene(channel, scene);
    pfInitClock(0.0f);
     
    while (!quit)
    {
        pfSync();
        time = pfGetTime();
        header = 10.0f*time;
        pfDCSRot(orbitRot, header, 0.0f, 0.0f);
        pfChanView(channel, shared->currentView.xyz, shared->currentView.hpr);
        pfFrame();
        pfuGetEvents(&events);
        processInput();
    }

    pfuExitInput();
    pfuExitUtil();
    pfExit();
    exit(0);
     
}

static void openPipeline(pfPipe * pipe)

{
    pfuGLXWindow * win;
    Display * XDpy;
    void * arena;
     
    XDpy = (Display *)pfuOpenXDisplay(0);
    win = pfuGLXWinopen((pfuXDisplay*)XDpy, pipe, "Rotatable view", 100, 500, 100, 500);
    pfInitGLXGfx(pipe, (void*)XDpy, win->xWin, win->glWin, win->overWin, PFGLX_AUTO_RESIZE);
    
}

static void processInput(void)

{
     
    long i, j, key, count;
    long dev, val, numDevs;
    pfuEvent * pfevents;
     
    pfevents = &(events);
     
    /*get the number of devices that produce events*/
     
    numDevs = pfevents->numDevs;
     
    /*process events for each device*/
    for (j = 0; j < numDevs; j++)
    {
        /*process the current device */
        dev = pfevents->devQ[j];
        /* check if device (dev) is not processed yet */
        if (pfevents->devCount[dev] > 0) /* greater 0 means not processed */
        {
            switch(dev) /*what device is this*/
            {
                case PFUDEV_KEYBD: /*we got keyboard here*/
                /*a number of key have been pressed*/
                for ( i = 0; i < pfevents->numKeys; i++)
                {
                    key = pfevents->keyQ[i];/*get the first key*/
                    if (count = pfevents->keyCount[key])
                    {
                        if (count > 1)
                        count = PF_MAX2((int)(count*(pfGetFrameRate()/60.0f)), 1);
                        switch(key){
                        case 27 : quit = 1;
                                  break;
                        case 'c': shared->dynamicView = 1;
                                  fprintf(stdout, "ON\n");
                                  /*pfGetNodeBSphere(orbitRot, &boxBSphere, PFN_BMODE_DYNAMIC);
                                  fprintf(stdout, "centerX = %f\n", boxBSphere.center[0]);
                                  fprintf(stdout, "centerY = %f\n", boxBSphere.center[1]);
                                  fprintf(stdout, "centerZ = %f\n", boxBSphere.center[2]);
                                  fprintf(stdout, "radius = %f\n", boxBSphere.radius);*/
                                  break;
                        case 'C': shared->dynamicView = 0;
                                  fprintf(stdout, "OFF\n");
                                  break;
                        case 'R': pfSetVec3(shared->currentView.xyz, 0.0f, -10.0f, 0.0f);
                                  pfSetVec3(shared->currentView.hpr, 0.0f, 0.0f, 0.0f);
                                  break;
                        default : break;
                        }
                     }
                }
                pfevents->devCount[dev] = 0;
                break;
                default : pfevents->devCount[dev] = 0;
                          break;/* we don't care this device, chuck off*/
                 
            }
             
        }
          
    }
     
    pfevents->numDevs = 0;
     
}

static void drawFrame(pfChannel * chan, void * data)

{
    /*do something like setting the view point here by calling the function*/
     
    pfClearChan(chan);
     
   if (shared->dynamicView)
   changeView();
    pfDraw();
}

 void changeView(void)

{
    pfSphere boxBSphere;
    pfGetNodeBSphere(orbitRot, &boxBSphere, PFN_BMODE_DYNAMIC);
    fprintf(stdout, "centerX = %f\n", boxBSphere.center[0]);
    fprintf(stdout, "centerY = %f\n", boxBSphere.center[1]);
    fprintf(stdout, "centerZ = %f\n", boxBSphere.center[2]);
    fprintf(stdout, "radius = %f\n", boxBSphere.radius);
    pfSetVec3(shared->orbitingView.xyz, boxBSphere.center[0], boxBSphere.center[1], boxBSphere.center[2]);
    pfSetVec3(shared->orbitingView.hpr, 90.0f + header, 0.0f, 0.0f);
    pfCopyVec3(shared->currentView.xyz, shared->orbitingView.xyz);
    pfCopyVec3(shared->currentView.hpr, shared->orbitingView.hpr);
}

=======================================================================
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:53:37 PDT

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