Move back and forth in the zclip sample

This commit is contained in:
Luke Benstead 2019-03-25 16:07:54 +00:00
parent 493592ea30
commit 7e47b21fb5

View File

@ -249,8 +249,28 @@ void RenderFloor() {
/* The main drawing function. */ /* The main drawing function. */
void DrawGLScene() void DrawGLScene()
{ {
static float z = 0.0f;
static char increasing = 1;
if(increasing) {
z += 10.0f;
} else {
z -= 10.0f;
}
if(z > 10.0f) {
increasing = !increasing;
z = 10.0f;
}
if(z < 0.0f) {
increasing = !increasing;
z = 0.0f;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View glLoadIdentity(); // Reset The View
glTranslatef(0, 0, z);
GLubyte i = 0; GLubyte i = 0;