graphene

view test/src/main.cc @ 6:9fbbc96e6fbe

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 31 Jul 2015 04:59:28 +0300
parents f85a59195206
children
line source
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "graphene3d.h"
4 #include <GL/glut.h>
6 void display();
7 void reshape(int x, int y);
8 void keydown(unsigned char key, int x, int y);
9 void mouse(int bn, int st, int x, int y);
10 void motion(int x, int y);
12 int main(int argc, char **argv)
13 {
14 glutInit(&argc, argv);
15 glutInitWindowSize(1280, 800);
16 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
17 glutCreateWindow("graphene3d test");
19 glutDisplayFunc(display);
20 glutReshapeFunc(reshape);
21 glutKeyboardFunc(keydown);
22 glutMouseFunc(mouse);
23 glutMotionFunc(motion);
25 if(!gph::init_opengl()) {
26 return 1;
27 }
29 glutMainLoop();
30 return 0;
31 }
33 void display()
34 {
35 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
37 glutSwapBuffers();
38 }
40 void reshape(int x, int y)
41 {
42 glViewport(0, 0, x, y);
43 }
45 void keydown(unsigned char key, int x, int y)
46 {
47 switch(key) {
48 case 27:
49 exit(0);
50 }
51 }
53 void mouse(int bn, int st, int x, int y)
54 {
55 }
57 void motion(int x, int y)
58 {
59 }