From: Larry E. Ramey (ramey++at++vrco.com)
Date: 06/07/2000 11:16:27
larry->scream(LOUD);
larry->tearHair();
larry->printState();
>Larry: State
Much calmer now, thank you.
It looks as if pfPrint has a bug in it. When I request a DEBUG print of
a geoSet it _appears_ as if the colors are whacky. Take a look at the
printout here:
pfVec4 *colors = (pfVec4*)
pfMalloc(sizeof(pfVec4)*4,pfGetSharedArena());
colors[0].set(1.0f, 1.0f, 1.0f, 1.0f);
colors[1].set(0.0f, 0.0f, 1.0f, 0.5f);
colors[2].set(1.0f, 0.0f, 0.0f, 0.5f);
colors[3].set(0.0f, 1.0f, 0.0f, 0.0f);
Strip Lengths: 4
Coord 0: X: -1.000000 Y: -1.000000 Z: -1.000000
Color 0: R: 1.000000 G: 1.000000 B: 1.000000 A:
1.000000
Coord 1: X: 1.000000 Y: -1.000000 Z: -1.000000
Color 1: R: 1.000000 G: 0.000000 B: 0.000000 A:
1.000000
Coord 2: X: 1.000000 Y: 1.000000 Z: -1.000000
Color 2: R: 1.000000 G: 0.500000 B: 1.000000 A:
0.000000
Coord 3: X: -1.000000 Y: 1.000000 Z: -1.000000
Color 3: R: 0.000000 G: 0.000000 B: 0.500000 A:
0.000000
Watch the colors. It looks like it prints 4 correct values, THEN repeats
the 4th value again, and then goes ahead and prints the next 4 values.
Mind you that things seem to be being DRAWN correctly, otherwise I would
have noticed this a long time ago.
Here is the full code used to generate this bug: (I hacked up hello.C)
// hello.c: Welcome Performer program for programmer's guide
//
// $Revision: 1.19 $
// $Date: 1995/11/22 14:34:58 $
//
#include <Performer/pfdu.h>
#include <Performer/pf/pfChannel.h>
#include <Performer/pf/pfLightSource.h>
#include <Performer/pf/pfText.h>
#include <Performer/pr/pfFont.h>
#include <Performer/pr/pfString.h>
int
main (int argc, char *argv[])
{
// Initialize and configure IRIS Performer
pfInit();
pfMultiprocess( PFMP_DEFAULT );
pfConfig();
// Look for files in PFPATH, ".", and "/usr/share/Performer/data"
pfFilePath(".:/usr/share/Performer/data:../../../../data");
// Create a scene
pfScene *scene = new pfScene;
// Create a lit scene pfGeoState for the scene
pfGeoState *gstate = new pfGeoState;
gstate->setMode(PFSTATE_ENLIGHTING, PF_ON);
// attach the pfGeoState to the scene
scene->setGState(gstate);
// put a default light source in the scene
scene->addChild(new pfLightSource);
// Create and configure a pfPipe and pfChannel.
pfPipe *pipe = pfGetPipe(0);
pfChannel *chan = new pfChannel(pipe);
chan->setFOV(60.0f, 0.0f);
chan->setScene(scene);
// Determine extent of scene's geometry.
chan->setNearFar(1.0f, 10.0f);
// Spin text for 15 seconds.
double startTime = pfGetTime();
double t;
pfVec4 *colors = (pfVec4*)
pfMalloc(sizeof(pfVec4)*4,pfGetSharedArena());
colors[0].set(1.0f, 1.0f, 1.0f, 1.0f);
colors[1].set(0.0f, 0.0f, 1.0f, 0.5f);
colors[2].set(1.0f, 0.0f, 0.0f, 0.5f);
colors[3].set(0.0f, 1.0f, 0.0f, 0.0f);
pfVec3 *coords = new pfVec3[4];
coords[0].set(-1.0f, -1.0f, -1.0f );
coords[1].set( 1.0f, -1.0f, -1.0f );
coords[2].set( 1.0f, 1.0f, -1.0f );
coords[3].set(-1.0f, 1.0f, -1.0f );
pfGeoSet *gset = new pfGeoSet;
gset->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, coords, NULL);
gset->setAttr(PFGS_COLOR4, PFGS_PER_VERTEX, colors, NULL);
gset->setPrimType(PFGS_TRISTRIPS);
gset->setNumPrims(1);
int* length = new int[1];
length[0] = 4;
gset->setPrimLengths(length);
pfPrint(gset, PFTRAV_SELF | PFTRAV_DESCEND, PFPRINT_VB_DEBUG, stdout);
pfCoord view;
view.hpr.set(45.0f,-5.0f, 0.0f);
view.xyz.set(2.0f,0.0f,0.3f );
chan->setView(view.xyz, view.hpr);
while ((t = pfGetTime() - startTime) < 1.0f)
{
// Initiate cull/draw processing for this frame.
pfFrame();
}
// Terminate parallel processes and exit.
pfExit();
return 0;
}
-- "Haven't you heard? We come in six packs now." -Zaphod Beeblebrox Larry E. Ramey ####NEW ADDRESS###### ramey++at++vrco.com
This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 11:04:36 PDT