Created
January 24, 2012 09:23
-
-
Save hermansc/1669227 to your computer and use it in GitHub Desktop.
Render GLUT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int SIZE = 1; | |
bool UP; | |
void Render() { | |
// Clean up the colour of the window and the depth buffer | |
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |
glMatrixMode(GL_MODELVIEW); | |
glLoadIdentity(); | |
// Set random colour on resize orange | |
glColor3f(GenerateRandomColor(), GenerateRandomColor(), GenerateRandomColor()); | |
// Draw a built-in primitive | |
// If the mutex UP is true we add 1 to the size, and if it is false we subtract. | |
// The range goes from 1 to 20. | |
if (SIZE == 20){ UP = false; } | |
if (SIZE == 1){ UP = true; } | |
if (UP) {SIZE += 1;} else { SIZE -= 1; } | |
glutSolidTeapot(SIZE); | |
// All drawing commands applied to the hidden buffer, so now, bring forward | |
// the hidden buffer and hide the visible one | |
glutSwapBuffers(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment