Re: OpenGL texture problems

New Message Reply Date view Thread view Subject view Author view

From: Don Burns (don_burns++at++peru.engr.sgi.com)
Date: 10/05/2000 09:50:05


On Oct 5, 3:19pm, Alan Freeman wrote:
> Subject: OpenGL texture problems
> Hi Performers
>
> I'm writing a performer app that renders a scene. then uses glReadPixels to
> grab what is in a section of the framebuffer, into a section memory I'm
> allocation specificaly.
> I then try to draw a quad over another section of the channel (using OpenGL
> calls) using the data I got from glReadPixels as a texture.
>
> It all works fine, except the texture I read from the framebuffer gets
> applied to one of the textures in the performer app (I'm using Performer
> town, and one of the tree textures gets replaced..)
>
> Any idea as to how I should stop the texture getting back into the performer
> rendering???
>
> cheers
>
> Alan

This is, more than likely, an artifact of mixing Performer and OpenGL calls.
 What you probably need to focus on is the state in which you leave the
rendering pipe after you've made your openGL calls. So, in this case, you've
probably called glBindTexture() and left the current texture set to whatever
you passed as an argument. Given the order things are executed and the
presence of the draw callback you are using to grab the frame buffer, the
current texture gets left as the contents of the frame buffer and not the tree
texture.

May I suggest that rather than using OpenGL calls to do this, you use
Performer? This will allow things to be executed correctly. The way to do
this is to make the quad a pfGeoSet, with a pfGeoState that contains a
pfTexture. Set the following parameters to the pfTexture (given screen
coordinates 0, 0, 512, 512 as the location of the frame buffer you want to
grab) :

    pfTexture *tex = new pfTexture;

    tex->setImage( NULL, 3, 512, 512, 0);
    tex->setLoadMode( PFTEX_LOAD_SOURCE, PFTEX_SOURCE_FRAMEBUFFER);
    tex->setFormat( PFTEX_INTERNAL_FORMAT, PFTEX_RGBA_8 );
    tex->setFormat( PFTEX_SUBLOAD_FORMAT, PF_ON);
    tex->setFilter( PFTEX_MINFILTER, PFTEX_BILINEAR);
    tex->setLoadOrigin( PFTEX_ORIGIN_SOURCE, 0, 0);
    tex->setLoadSize( 512, 512 );

Then, for each frame, to effect the frame buffer grab and texture update:

    tex->load();

-don


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Oct 05 2000 - 09:50:50 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.