Skip to content

Instantly share code, notes, and snippets.

@tamakiii
Created February 1, 2018 13:18
Show Gist options
  • Save tamakiii/c64c0176ad6380ba1dea50020cd03318 to your computer and use it in GitHub Desktop.
Save tamakiii/c64c0176ad6380ba1dea50020cd03318 to your computer and use it in GitHub Desktop.
OpenGL timer
#include <GLUT/GLUT.h>
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glRotatef(1, 0, 0, 1);
glutWireTeapot(1);
glutSwapBuffers();
}
void timer(int value) {
glutPostRedisplay();
glutTimerFunc(1000/60, timer, 0);
}
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);
glutTimerFunc(0, timer, 0);
glutMainLoop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment