Skip to content

Instantly share code, notes, and snippets.

@hermansc
Created January 24, 2012 09:23
Show Gist options
  • Select an option

  • Save hermansc/1669227 to your computer and use it in GitHub Desktop.

Select an option

Save hermansc/1669227 to your computer and use it in GitHub Desktop.

Revisions

  1. hermansc created this gist Jan 24, 2012.
    25 changes: 25 additions & 0 deletions gistfile1.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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();
    }