render to texture, ordering help!

Hi, as part of a project I am trying to project textures onto a plane, then render the plane, then using glCopyTexImage2D() I grab the screen, copy to a texture, and project this texture onto another plane, and finally render this to screen, this as my visual output.

I first coded it as follows…

glCopyTexImage2D(to new grabbed texture);

What seems to happen is the screengrabbed texture is rendered first, then the pixelshaded textures are projected and rendered on top. This seems to be in the wrong order to me?!

So I tried doing it the other way round,

glCopyTexImage2D(to grabbed texture);

Now the grabbed texture is rendered on top, as I want, however the texture contains the image of the grabbed texture. Hope this makes sense!

Basically I am wondering what I can do? I have no idea why they are being rendered in the wrong order, and it’s probably me being stupid, that’s why I’ve posted in the beginner forum!!

Any help would be VERY gratefully received!!



I’ve just found that my program works if I call glFlush(). Now I have to find out why…! :slight_smile: