Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Jun 23 '12 at 23:49

This question came from our site for professional and enthusiast programmers.

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.

share|improve this answer
+1; definitely just redraw the entire scene every frame. It's not going to be a performance problem - honest! - and GPUs are intended to be used this way anyhow, so it will likely be much faster than trying anything clever or tricksy to avoid doing so. – Le Comte du Merde-fou Jun 24 '12 at 0:22

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.