From: Stephane Jaeger (stephane.jaeger++at++imag.fr)
Date: 04/06/2001 09:55:44
Hi,
I am trying to read the backbuffer and copy it onto a pftexture. I use
two channels added on the same pfPipeWindow. The first channel acts just
as a regular channel and renders the scene while the second
reads the previously rendered scene, updates a pftexture and renders its
own scene using the texture. To ensure the update of the pfTexture after
the first channel's rendering, I use a traversal callback for the second
channel in which I do a pfTexture->subLoad() call before the pfDraw().
Hence I assume that the first channel renders to the backbuffer and
that Performer doesn t swap the buffer in between the second channel's
rendering. Is that right so far ?
The trouble is that my pfTexture doesn t update. I suppose it comes from
the fact I am setting wrong parameters for the subload routine. Notice
that I need to initialize my pftexture object by loading .rgb file
otherwise I m getting the following warning for each frame at run-time:
PF Warning/Usage: pfTexture::apply() - bad number of
components -1
Does anybody know what's going on ?
Thank you for your help,
Stephane
Following are the texture initialisation and the traversal callback.
---------------------------------------
spotTex = new pfTexture();
if ( ! spotTex->loadFile("blackbg.rgb"))
exit(1);
firstpass->getPWin()->getSize(&x,&y);
spotTex->setRepeat(PFTEX_WRAP, PFTEX_CLAMP);
spotTex->setFormat(PFTEX_SUBLOAD_FORMAT, PF_ON);
spotTex->setLoadOrigin(0, 0, 0);
spotTex->setLoadOrigin(1, 0, 0);
spotTex->setLoadSize(x,y);
spotTex->setLoadMode(PFTEX_LOAD_SOURCE, PFTEX_SOURCE_FRAMEBUFFER);
-----------------------------------------
static void MyTravFunc (pfChannel *channel, void *)
{
//channel->clear(); //wouldn t it clear the backbuffer I m trying to
read thereafter
//update window size
channel->getPWin()->getSize(&x, &y);
spotTex->subload(PFTEX_SOURCE_FRAMEBUFFER, NULL, 0, 0,x, 0, 0, x,y);
pfDraw();
}
This archive was generated by hypermail 2b29 : Fri Apr 06 2001 - 09:55:50 PDT