Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "cube.hpp"
- #include <windows.h> // only on windows ;)
- #include <GL/glut.h>
- Cube *cube = new Cube(75.0f);
- void display()
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glPushMatrix();
- cube->draw();
- glPopMatrix();
- glutSwapBuffers();
- }
- void timer(int = 0)
- {
- cube->tick();
- display();
- glutTimerFunc(10, timer, 0);
- }
- int main(int argc, char **argv)
- {
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 400);
- glutInitWindowPosition(600, 300);
- glutCreateWindow("Cube");
- glClearColor(0, 0, 0, 1.0);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glEnable(GL_DEPTH_TEST);
- gluPerspective(45, 1, 37, 500);
- glMatrixMode(GL_MODELVIEW);
- glutDisplayFunc(display);
- timer();
- glutMainLoop();
- }
Advertisement
Add Comment
Please, Sign In to add comment