Louis Bolduc (louis++at++speech.iar.nrc.ca)
Wed, 3 Aug 94 09:28:54 EDT
My system is an Indigo Elan running IRIX 5.2 and Performer 1.2...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <gl/device.h>
#include <Performer/pf.h>
static pfVec3 coords [] = {
{ 0.0F, -30.0F, 0.0F },
{ 0.0F, 30.0F, 0.0F },
{ -30.0F, 0.0F, 0.0F },
{ 30.0F, 0.0F, 0.0F },
{ 0.0F, 0.0F, -30.0F },
{ 0.0F, 0.0F, 30.0F }
};
static pfVec4 colors [] = {
{ 1.0F, 1.0F, 1.0F, 1.0F }
};
static pfGeode *make_lines ( void )
{
void *arena = pfGetSharedArena ();
pfGeoSet *gset = pfNewGSet ( arena );
pfGeoState *gstate = pfNewGState ( arena );
pfGeode *lines = pfNewGeode ();
pfGSetAttr ( gset, PFGS_COORD3, PFGS_PER_VERTEX, coords, NULL );
pfGSetAttr ( gset, PFGS_COLOR4, PFGS_OVERALL, colors, NULL );
pfGSetPrimType ( gset, PFGS_LINES );
pfGSetNumPrims ( gset, 3 );
pfGSetLineWidth ( gset, 5.0F );
pfGSetGState ( gset, gstate );
pfAddGSet ( lines, gset );
return lines;
}
static void OpenPipeline ( pfPipe *p )
{
foreground ();
prefposition ( 100, 500, 100, 500 );
winopen ( "IRIS Performer" );
pfInitGfx ( p );
pfApplyMtl ( pfNewMtl ( pfGetSharedArena () ) );
pfApplyLModel ( pfNewLModel ( pfGetSharedArena () ) );
}
main ()
{
float t = 0.0f;
pfScene *scene;
pfPipe *p;
pfChannel *chan;
pfInit ();
pfMultiprocess ( PFMP_DEFAULT );
pfConfig ();
scene = pfNewScene ();
pfAddChild ( scene, make_lines () );
pfAddChild ( scene, pfNewLSource () );
p = pfGetPipe ( 0 );
pfInitPipe ( p, OpenPipeline );
chan = pfNewChan ( p );
pfChanScene ( chan, scene );
pfChanNearFar ( chan, 1.0f, 1000.0f );
pfChanFOV ( chan, 45.0f, 0.0f );
pfInitClock ( 0.0f );
while ( t < 20.0f ) {
float s, c;
pfCoord view;
pfSync ();
t = pfGetTime ();
pfSinCos ( 45.0f * t, &s, &c );
pfSetVec3 ( view.hpr, 45.0f * t, -10.0f, 0 );
pfSetVec3 ( view.xyz, 100.0f * s, -110.0f * c, 30.0f );
pfChanView ( chan, view.xyz, view.hpr );
pfFrame ();
}
pfExit ();
return 0;
}
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:26 PDT