Skip to content

Instantly share code, notes, and snippets.

@hermansc
Created January 24, 2012 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hermansc/1669227 to your computer and use it in GitHub Desktop.
Save hermansc/1669227 to your computer and use it in GitHub Desktop.
Render GLUT
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