PDA

View Full Version : Constant background



10-19-2005, 10:22 AM
I have a background where there are lines, which I can draw using GL_LINE. An object, a squre block, moves in this background. I guess it is efficient to redraw only the object when it moves, since the background does not change. Is there any way of doing this?

jasso
10-20-2005, 09:17 PM
There are a couple ways to do this. One way is to use a display list to draw the portions of your scene that don't change. In your setup routine, put the code that draws the lines in a display list in retained mode (as opposed to immediate mode). Then in your display routine, call the display list followed by the code that draws the moving square. This will give you a big performance boost because even though you'll call the display list each time through your display routine, you'll effectively only have drawn the background once, when you set up the display list.

10-25-2005, 06:19 AM
Thank you very much. It was really helpful.