cubemapper

view src/main.cc @ 1:d7a29cb7ac8d

resize to the final cubemap face size
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 28 Jul 2017 07:44:35 +0300
parents 8fc9e1d3aad2
children e308561f9889
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 glutInitWindowSize(1024, 768);
18 glutInit(&argc, argv);
19 glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
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 void app_resize(int x, int y)
53 {
54 glutReshapeWindow(x, y);
55 }
57 static void display()
58 {
59 app_draw();
60 }
62 static void reshape(int x, int y)
63 {
64 app_reshape(x, y);
65 }
67 static void keydown(unsigned char key, int x, int y)
68 {
69 app_keyboard(key, true);
70 }
72 static void mouse(int bn, int st, int x, int y)
73 {
74 app_mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y);
75 }
77 static void motion(int x, int y)
78 {
79 app_mouse_motion(x, y);
80 }