Render to texture and using it

Let’s say I want to render my entire scene to a RTT, then use the texture an render a fullscreen quad.
This is the case for many post processing effects.
Would this be like a glFinish?

I’m thinking of coding something like this:

  • make 2 RTT
  • render to RTT 1
  • use RTT 2 to render a fullscreen quad
  • SwapBuffers
  • render to RTT 2
  • use RTT 1 to render a fullscreen quad
  • SwapBuffers
  • goto OVERHERE

I’m not sure if the question is clear. would what be like a glFinish?
SwapBuffers doesnt require a glFinish i think.

alternatively :
int current=0, previous=1;
render to RTT[current]
render RTT[previous] to fullscreen quad

if (current==0) { current=1; previous=0;}
else { current=0; previous=1;}


Basically, SwapBuffers calls Finish internally, also, using a texture will require that all rendering operations are finished. Still I am not sure if you will get a performance win. Let us assume that the card can work on one render target at time, then your first SwapBuffers will finish the rendering to RTT1 and from RTT2 to the screen. So no win here. Still, you could try this out and tell us if there is a difference :slight_smile:

Not sure if I was clear so I will restate it.

Basically, I want to do a post processing effect, like glow or whatever.
I need to render the scene to a RTT. Then I render a fullscreen quad and use the RTT.

Let’s say in my naive implementation, I do this.

  • make 1 RTT when program starts
  • render to RTT
  • use RTT to render a fullscreen quad
  • SwapBuffers
  • goto OVERHERE

As you can see, the GPU is force to complete all rendering to the RTT before I can use it to render the fullscreen quad.

But if I use the code from my first post, perhaps magically I will gain some FPS.

game_cy, I don’t see the difference between your pseudo code and mine.

SwapBuffers doesn’t call glFinish. It is glFlush.

However, I’m wondering if rendering to a RTT and suddenly using it will cause a glFinish.

There is a win if I put some CPU related work in the right places.

Theres no difference except that you only have the same code (rendering) in one place instead of two, so you wont forget to edit both parts and create bugs :slight_smile: