Skip to content

Instantly share code, notes, and snippets.

@tamakiii
Created January 31, 2018 15:35
Show Gist options
  • Save tamakiii/8e1af32c5c99588a78c44f31912c2f01 to your computer and use it in GitHub Desktop.
Save tamakiii/8e1af32c5c99588a78c44f31912c2f01 to your computer and use it in GitHub Desktop.
OpenGL Animation with Double Buffering
#include <GLUT/GLUT.h>
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glRotatef(1, 0, 0, 1);
glutWireTeapot(1);
glutSwapBuffers();
}
void idle(void) {
glutPostRedisplay();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition(640, 0);
glutInitWindowSize(640, 640);
glutCreateWindow("Title");
glClearColor(0, 0, 0, 1.0f);
glutDisplayFunc(display);
glutIdleFunc(idle);
glutMainLoop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment