What's wrong

New Message Reply Date view Thread view Subject view Author view

Tawfek Mukhtar (tawfek++at++media1.rndtm.com.my)
Fri, 1 Mar 1996 16:50:00 -0800


I've copied program
/usr/src/Performer/src/pguide/libpr/examples/colorcube.c

and modify it so that everything is in one main(). Compile it nothing wrong
but it won't execute.(Bus error (core dumped)). Any suggestion ? Thanks a lot.

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

#include "pfsgi.h"
#include "pr.h"
static pfVec3 vertices[] = {
    {-1.0, -1.0, 1.0},
    {1.0, -1.0, 1.0},
    {1.0, 1.0, 1.0},
    {-1.0, 1.0, 1.0},
    {-1.0, -1.0, -1.0},
    {1.0, -1.0, -1.0},
    {1.0, 1.0, -1.0},
    {-1.0, 1.0, -1.0}
};

ushort svindex[] = {
    0, 1, 2, 3, /*front*/
    0, 3, 7, 4, /*left*/
    4, 7, 6, 5, /*back*/
    1, 5, 6, 2, /*right*/
    3, 2, 6, 7, /*top*/
    0, 4, 5, 1 /*bottom*/
};

static pfVec3 snorms[] = {
    {0.0, 0.0, 1.0},
    {0.0, 0.0, -1.0},
    {0.0, 1.0, 0.0},
    {0.0, -1.0, 0.0},
    {1.0, 0.0, 0.0},
    {-1.0, 0.0, 0.0}
};

ushort snindex[] = { 0,
                    5,
                    1,
                    4,
                    2,
                    3 };

static pfVec4 scolors[] ={ {1.0f, 1.0f, 1.0f, 1.0f},
                                {0.0f, 0.0f, 1.0f, 1.0f},
                                {1.0f, 0.0f, 0.0f, 1.0f},
                                {0.0f, 1.0f, 0.0f, 1.0f} };

static ushort scindex[] = { 0, 1, 2, 3,
                                  0, 1, 2, 3,
                                  0, 1, 2, 3,
                                  0, 1, 2, 3,
                                  0, 1, 2, 3,
                                  0, 1, 2, 3 };

int main(int argc, char * argv[])
{
    pfScene * scene;
    pfGeode * geode;
    pfGeoSet * gSet;
    pfGeoState * gState;
    pfPipe * pipe;
    pfChannel * channel;
    pfNode * object;
    pfCoord view;
    float time = 0.0f;
    float maxTime;

    pfInit();
    pfConfig();

    pipe = pfGetPipe(0);
    channel = pfNewChan(pipe);

    gState = pfNewGState(pfGetSharedArena());
    gSet = pfNewGSet(pfGetSharedArena());

    pfGSetAttr(gSet, PFGS_COORD3, PFGS_PER_VERTEX, vertices, svindex);
    pfGSetAttr(gSet, PFGS_NORMAL3, PFGS_PER_PRIM, snorms, snindex);
    pfGSetAttr(gSet, PFGS_COLOR4, PFGS_PER_VERTEX, scolors, scindex);

    pfGSetPrimType(gSet, PFGS_QUADS);
    pfGSetNumPrims(gSet, 6);

    pfGStateMode(gState, PFSTATE_ENTEXTURE, 0);
    pfGStateMode(gState, PFSTATE_TRANSPARENCY, 1);
    pfGSetGState(gSet, gState);

    geode = pfNewGeode();
    pfAddChild(geode, gSet);

    scene = pfNewScene();

    pfAddChild(scene, geode);

    pfChanScene(channel, scene);
    pfInitPipe(pipe, NULL);

    pfSetVec3(view.xyz, 10.0, -10.0, 10.0);
    pfSetVec3(view.hpr, 45.0, -10.0, 0.0);

    pfInitClock(0.0f);

    pfChanView(channel, view.xyz, view.hpr);

    while(time < maxTime){
        pfSync();
        time = pfGetTime();
        pfFrame();
    }

    pfExit();
    exit(0);
}
=======================================================================
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:31 PDT

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