View Full Version : Quickest scene background redraw

12-18-2005, 09:37 AM
I am new to GL but it appears that my question still belongs in this thread (please no flames).
I have an application that requires a static graphic background along with several graphics overlays.
I was told by one guru at nvidia that is is quicker in most cases to redraw the complete background than to save items under the motion and then restore them.
To that end I started with a dual buffer display drawing a quad that filled the screen with a 2D texture of my background. This works but is slower than I had hoped for at 1024x768.
The guru then sent me a paper on pbuffers. I have implemented the pbuffer and as far as I can tell, I am drawing a textured quad to that space as well.
My question is what's next? I assumed that rendering to the pbuffer would give me a static rendered background that I would be able to transfer via some highspeed byte transfer to my backbuffer.
Is that possible? If so, what commands are involved in doing this transfer?

12-18-2005, 09:01 PM
I believe the fastest way to draw a static background is by rendering a texturemapped quad. Works seamlessly on all hardware and platforms :) . Can you let us know why you think it is slow? Did you benchmark it? if so, against what?

12-19-2005, 05:07 PM
How are your drawing your quad? Can you provide a code snippet that will show us what you are doing? The majority of games out their will use this technique in one for or another (skyboxes are simply a 3D version of what you are doing).

One (very simple) optimization is to draw the background last. At the beginning of each frame you clear the Depth buffer (only), draw your geometry and then draw your backdrop last. If you are just using a quad then you can switch to Ortho and draw the quad using glDepthFunc(GL_GREATER) with the quad closer to the viewpoint than all of your geometry.

One piece of information that you could provide (that would be useful) is the comparison between drawing the quad, and not drawing it (there shouldn't be much difference at all) and the hardware you are using.

At any rate, this isn't an advanced question.