Take for an example I have the background scene of a game which should remain static for an interval.Then for every time redrawing the scene,is it better for me to store the color buffer for every pixel on the viewport and redrawing using the stored color buffer or to applying a texture to the whole background or to draw the triangular,quad meshes?
migrated from stackoverflow.com Jun 23 '12 at 23:49
In short: If you are developing for a modern machine, you usually can redraw everything that should be on the screen, the only exception being images that are difficult to compute/are computed once every few frames because of perfomance hit.
Detailed: Try rendering the static parts just like the dynamic. Premature optimization is the root of all evil, and you should generally avoid it. Measure the timings, and there's huge chance you won't even need to cache the background at all.
If, however rendering the background is expensive, you should use FBO to store the data. The method of putting it back on the screen depends on the type of game you're writing, however textured quad rendered with basic fragment shader shouldn't be too slow compared to direct pixel-copy. It will also allow you to reduce the size of the background, if you feel that storing whole screen is too much.
Assuming you can draw on the buffer effectively and you're using a 'clean' scene (only the stuff you want in the background permanently) to render the initial background, using the buffer should be a faster way of rendering the composite scene. This is especially true if the background isn't a simple image file but rather a separate redering. Even if you are just using a bilboard image in the back of the scene, rendering the polygons and textures to the image buffer is much higher up in the graphics pipeline.