From: Gary Quinn (G.Quinn++at++tees.ac.uk)
Date: 03/25/2004 07:24:24
PfHi !
I'm trying to grab the frame buffer into a pfTex,
ultimately for dome distortion, but I'm getting
strange results...
When I read the framebuffer, and draw a textured
GL_QUAD in the top right of the frame I'm getting
different (and wrong) results on an O2 and a PC.
On an O2 performer 2.5.3 runtime...
http://vr.tees.ac.uk/gary/grab_sgi.jpg
The topleft triangle (of the GL_QUAD) is
correct, but the bottom right triangle is
wrong.
However, on a PC performer 3.0.2
http://vr.tees.ac.uk/gary/grab_pc.jpg
the whole GL_QUAD texture is sheared, and
the amount of shear changes at each frame
To setup the pfTexture...
texture = pfNewTex(shared->arena);
image = (unsigned int *)pfMalloc(sizeof(unsigned
int)*sizeTex*sizeTex, shared->arena);
pfApplyTEnv( pfNewTEnv( shared->arena ) );
pfTexLoadMode(texture, PFTEX_LOAD_SOURCE,
PFTEX_SOURCE_FRAMEBUFFER);
pfTexFormat(texture, PFTEX_EXTERNAL_FORMAT, PFTEX_PACK_8);
//PFTEX_PACK_8
pfTexFormat(texture, PFTEX_INTERNAL_FORMAT, PFTEX_RGBA);
//PFTEX_RGBA_8
pfTexFormat(texture, PFTEX_IMAGE_FORMAT, PFTEX_RGBA); //PFTEX_RGBA
pfTexName(texture, "Frame Buffer Texture");
pfTexImage(texture, image, 4, sizeTex, sizeTex, 1);
pfTexLoadOrigin(texture, PFTEX_ORIGIN_SOURCE, 0, 0);
pfTexLoadOrigin(texture, PFTEX_ORIGIN_DEST, 0, 0);
pfTexLoadSize(texture, sizeTex, sizeTex);
pfTexFormat(texture, PFTEX_SUBLOAD_FORMAT, PF_ON);
pfTexFilter(texture, PFTEX_MINFILTER, PFTEX_BILINEAR);
pfTexFilter(texture, PFTEX_MAGFILTER, PFTEX_BILINEAR);
pfApplyTex(texture);
Then to use the texture after pfDraw() in the draw callback...
pfLoadTex(texture);
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
glVertex2f(xsize/2.0f, ysize/2.0f);
glTexCoord2f(0.0f,0.0f);
glVertex2f(xsize,ysize/2.0f);
glTexCoord2f(0.0f,1.0f);
glVertex2f(xsize,ysize);
glTexCoord2f(1.0f,1.0f);
glVertex2f(xsize/2.0f,ysize);
glTexCoord2f(1.0f,0.0f);
glEnd();
In an attempt to narrow down the problem, I
tried ...
pfSaveTexFile(texture, filename);
but that just gives me a blank image in the file.
Sadly, www.dorbie.com seems to be down :-(
What am I doing wrong ?
Cheers,
Gary.
--Gary Quinn, VR Centre Technical Manager University of Teesside SGI Network Admin Borough Road, Middlesbrough Go Player Cleveland, TS1 3BA mailto:Gary++at++tees.ac.uk +44 (0)1642 384303 fax 384310 http://vr.tees.ac.uk
#include <std.disclaimer>
This archive was generated by hypermail 2b29 : Thu Mar 25 2004 - 07:27:12 PST