Home > OS >  OpenGL Static Background
OpenGL Static Background

Time:03-31

I'm trying to create two rectangles using glut, while having one constant as a static background, and the other move around.

How can one go about making a static background that doesn't disappear whenever I move the second object?

What I currently get is that only the object that I draw second (not the background) appears on the output screen, while the background is empty (black).

CodePudding user response:

After you clear the screen, draw everything that you want to be on the screen. This is how it works in OpenGL. It doesn't remember anything like "there was a background here" - it just processes drawing commands.

  • Related