From: John Kelso (kelso++at++nist.gov)
Date: 05/19/2004 09:48:56
Hi all,
Below is a modified version of simple.C which creates two windows with a
single channel in each. One channel has drawStats called every frame.
When I do the drawStats in the first window/channel, I see both lines and
text. If I switch to the second window/channel by changing the line to
pfChannel *statsChan = chan[1] ;
all I get is the lines- no text is shown. Why is this??
As another test I made a variation on this program which displays the two
channels in non-overlapping viewports in a single window, and I was able
to see text using either channel. So it seems that it has something to
do with multiple windows
Also, and this applies to either window/channel, the line
statsChan->getFStats()->setClass(PFSTATS_ALL, PFSTATS_ON) ;
seems to add a dark translucent "curtain" across the channel, as well as
adding the extra statistics. How can I add the statistics but lose the
curtain??
This was run on a Dell Latitude D800 with Red Hat 9 and Performer 3.1
Please let me know if you know what I might be doing wrong.
Many thanks,
-John
//////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <Performer/pf/pfChannel.h>
#include <Performer/pf/pfLightSource.h>
#include <Performer/pf/pfNode.h>
#include <Performer/pf/pfScene.h>
#include <Performer/pf/pfFrameStats.h>
#include <Performer/pfutil.h>
#include <Performer/pfdu.h>
int main (int argc, char **argv) {
if (argc < 2) {
pfNotify(PFNFY_FATAL, PFNFY_USAGE, "Usage: %s file.ext ...\n",argv[0]);
pfExit() ;
}
pfInit();
for (int i=1; i<argc; i++)
pfdInitConverter(argv[i]);
pfConfig();
pfFilePath(".:/usr/share/Performer/data");
pfScene *scene = new pfScene;
scene->addChild(new pfLightSource);
for (int i=1; i<argc; i++) {
if (! (scene->addChild(pfdLoadFile(argv[i]))))
pfExit();
}
pfPipe *p = pfGetPipe(0);
// set up two nearly identical windows and channels
pfPipeWindow *pw[2] ;
pfChannel *chan[2] ;
char *name[2] = {"one", "two"} ;
for (int i=0; i<2; i++) {
pw[i] = new pfPipeWindow(p);
pw[i]->setName(name[i]);
pw[i]->setOriginSize(i*500,0,500,500);
chan[i] = new pfChannel(p);
chan[i]->setScene(scene);
pw[i]->addChan(chan[i]) ;
pw[i]->open();
}
// choose which channel to display stats- 0 or 1
pfChannel *statsChan = chan[0] ;
// this adds a translucent "curtain" over the channel
statsChan->getFStats()->setClass(PFSTATS_ALL, PFSTATS_ON) ;
pfSphere bsphere;
scene->getBound(&bsphere);
for (int i=0; i<2; i++)
chan[i]->setNearFar(1.0f, 10.0f * bsphere.radius);
float t = 0.0f;
while (t < 10.0f) {
pfCoord view;
float s, c;
pfSync();
statsChan->drawStats();
pfFrame();
t = pfGetTime();
pfSinCos(45.0f*t, &s, &c);
view.hpr.set(45.0f*t, -10.0f, 0);
view.xyz.set(2.0f * bsphere.radius * s,
-2.0f * bsphere.radius *c,
0.5f * bsphere.radius);
for (int i=0; i<2; i++)
chan[i]->setView(view.xyz, view.hpr);
}
pfExit();
// yeah, like we'll really get to return 0- but we have to make the
// compiler happy all the same 8^)
return 0;
}
This archive was generated by hypermail 2b29 : Wed May 19 2004 - 09:51:15 PDT