cubemapper

view src/main.cc @ 0:8fc9e1d3aad2

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 27 Jul 2017 20:36:12 +0300
parents
children d7a29cb7ac8d
line source
1 #include <stdlib.h>
2 #ifdef __APPLE__
3 #include <GLUT/glut.h>
4 #else
5 #include <GL/glut.h>
6 #endif
7 #include "app.h"
9 static void display();
10 static void reshape(int x, int y);
11 static void keydown(unsigned char key, int x, int y);
12 static void mouse(int bn, int st, int x, int y);
13 static void motion(int x, int y);
15 int main(int argc, char **argv)
16 {
17 glutInit(&argc, argv);
18 glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
19 glutInitWindowSize(1024, 768);
20 glutCreateWindow("cubemapper");
22 glutDisplayFunc(display);
23 glutReshapeFunc(reshape);
24 glutKeyboardFunc(keydown);
25 glutMouseFunc(mouse);
26 glutMotionFunc(motion);
28 if(!app_init(argc, argv)) {
29 return 1;
30 }
32 glutMainLoop();
33 return 0;
34 }
36 void app_quit()
37 {
38 app_cleanup();
39 exit(0);
40 }
42 void app_redisplay()
43 {
44 glutPostRedisplay();
45 }
47 void app_swap_buffers()
48 {
49 glutSwapBuffers();
50 }
52 static void display()
53 {
54 app_draw();
55 }
57 static void reshape(int x, int y)
58 {
59 app_reshape(x, y);
60 }
62 static void keydown(unsigned char key, int x, int y)
63 {
64 app_keyboard(key, true);
65 }
67 static void mouse(int bn, int st, int x, int y)
68 {
69 app_mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y);
70 }
72 static void motion(int x, int y)
73 {
74 app_mouse_motion(x, y);
75 }