[info-performer] Speed slowdown

Date view Thread view Subject view Author view

From: Juan Manuel Cappi (jcappi++at++sol.info.unlp.edu.ar)
Date: 06/24/2004 13:12:57


Hi,
   recently I run into a weird problem regarding speed. I have a
procedure that is in charge of creating a window, perform some
animation and the close the window; this procedure may be called many
times during my program execution. The thing is that, the first time
the procedure is called everything goes ok, but in the following calls
there is a noticeable speed slowdown (I'm running this on Win2k).

To show an example of this problem I wrote the following code:

pfVec3 coords[] =
       {
           {-1.0, 1.0, 0.0},
           {-1.0,-1.0, 0.0},
           { 1.0,-1.0, 0.0},
           { 1.0, 1.0, 0.0},
       };

pfVec4 colors[] =
       {
           {1.0,0.0,0.0,1.0},
           {0.0,1.0,0.0,1.0},
           {0.0,0.0,1.0,1.0},
           {0.5,0.5,0.5,1.0}
       };

void animation()
{
        pfPipe *pipe;
        pfPipeWindow *pw;
        pfChannel *chan;
        pfScene *scene;
        pfGeode *geode;
        pfGeoSet *geoset;
        pfVec3 xyz;
        pfVec3 hpr;
        double t;
        double c;

pipe=pfGetPipe(0);

pw=pfNewPWin(pipe);
pfPWinType(pw,PFPWIN_TYPE_X);
pfPWinOriginSize(pw,100,100,500,500);

chan=pfNewChan(pipe);

pfAddChan(pw,chan);

pfOpenPWin(pw);

scene=pfNewScene();
pfChanScene(chan,scene);

geoset=pfNewGSet(NULL);
pfGSetPrimType(geoset,PFGS_QUADS);
pfGSetNumPrims(geoset,1);
pfGSetAttr(geoset,PFGS_COORD3,PFGS_PER_VERTEX,coords,NULL);
pfGSetAttr(geoset,PFGS_COLOR4,PFGS_PER_VERTEX,colors,NULL);

geode=pfNewGeode();
pfAddGSet(geode, geoset);
pfAddChild(scene,geode);

pfSetVec3(xyz, 0.0f,-2.82f,0.607f);
pfSetVec3(hpr, 0.0f, 0.0f, 0.0f);

pfChanView(chan, xyz, hpr);

c=pfGetTime();

for(t=1;t<=360;t++)
{
pfSync();
pfFrame();
pfSetVec3(hpr, 0.0f, 0.0f, t/2);
xyz[PF_Z]+=0.00125;
pfChanView(chan, xyz, hpr);
}

printf("%f \n",(pfGetTime() - c));

pfChanScene(chan,NULL); //scene ref-count is now 0
pfDelete(scene); //delete scene and all of its childs

pfRemoveChan(pw,chan);
pfClosePWin(pw);
return;
}

int main(int argc, char* argv[])
{
int i;
pfInit();
pfConfig();
for(i=1; i<=5; i++)
{
        printf("Run %i \n",i);
        animation();
}
getchar();
pfExit();
return(0);

}

and the output I got is:

PF ================================================
PF = OpenGL Performer 3.1 =
PF = DEMO EDITION =
PF ================================================
PF = For information about purchasing the full =
PF = OpenGL Performer product, visit =
PF = http://www.sgi.com/software/performer/ =
PF ================================================
PF Notice/Resource: Using generic graphics type 30.
PF Notice: MUSTRUN of stage 1 on CPU 1196 not available for
this platform.

Run 1
PF Notice/Resource: Using generic graphics type 30.
5.481832

Run 2
PF Notice/Resource: Using generic graphics type 30.
PF Warning: No VClock. Assuming 60Hz video rate
8.473171

Run 3
PF Notice/Resource: Using generic graphics type 30.
8.416398

Run 4
PF Notice/Resource: Using generic graphics type 30.
8.328538

Run 5
PF Notice/Resource: Using generic graphics type 30.
8.476130

Which actually shows the big time difference between the first run and
the others. What am I doing wrong? Is there memory that should be
de-allocated that I'm not freeing? Also: could someone tell me why the
"No VClock" warning appears the second time I run the procedure? Has
this anything to do with this speed issue?

Many thanks in advance,
                       Juan


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Jun 24 2004 - 12:59:15 PDT