cubemapper

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/main.cc	Thu Jul 27 20:36:12 2017 +0300
     1.3 @@ -0,0 +1,75 @@
     1.4 +#include <stdlib.h>
     1.5 +#ifdef __APPLE__
     1.6 +#include <GLUT/glut.h>
     1.7 +#else
     1.8 +#include <GL/glut.h>
     1.9 +#endif
    1.10 +#include "app.h"
    1.11 +
    1.12 +static void display();
    1.13 +static void reshape(int x, int y);
    1.14 +static void keydown(unsigned char key, int x, int y);
    1.15 +static void mouse(int bn, int st, int x, int y);
    1.16 +static void motion(int x, int y);
    1.17 +
    1.18 +int main(int argc, char **argv)
    1.19 +{
    1.20 +	glutInit(&argc, argv);
    1.21 +	glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    1.22 +	glutInitWindowSize(1024, 768);
    1.23 +	glutCreateWindow("cubemapper");
    1.24 +
    1.25 +	glutDisplayFunc(display);
    1.26 +	glutReshapeFunc(reshape);
    1.27 +	glutKeyboardFunc(keydown);
    1.28 +	glutMouseFunc(mouse);
    1.29 +	glutMotionFunc(motion);
    1.30 +
    1.31 +	if(!app_init(argc, argv)) {
    1.32 +		return 1;
    1.33 +	}
    1.34 +
    1.35 +	glutMainLoop();
    1.36 +	return 0;
    1.37 +}
    1.38 +
    1.39 +void app_quit()
    1.40 +{
    1.41 +	app_cleanup();
    1.42 +	exit(0);
    1.43 +}
    1.44 +
    1.45 +void app_redisplay()
    1.46 +{
    1.47 +	glutPostRedisplay();
    1.48 +}
    1.49 +
    1.50 +void app_swap_buffers()
    1.51 +{
    1.52 +	glutSwapBuffers();
    1.53 +}
    1.54 +
    1.55 +static void display()
    1.56 +{
    1.57 +	app_draw();
    1.58 +}
    1.59 +
    1.60 +static void reshape(int x, int y)
    1.61 +{
    1.62 +	app_reshape(x, y);
    1.63 +}
    1.64 +
    1.65 +static void keydown(unsigned char key, int x, int y)
    1.66 +{
    1.67 +	app_keyboard(key, true);
    1.68 +}
    1.69 +
    1.70 +static void mouse(int bn, int st, int x, int y)
    1.71 +{
    1.72 +	app_mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN, x, y);
    1.73 +}
    1.74 +
    1.75 +static void motion(int x, int y)
    1.76 +{
    1.77 +	app_mouse_motion(x, y);
    1.78 +}