vrfileman

view src/app.cc @ 0:dca518e371cf

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 30 Jan 2015 12:25:16 +0200
parents
children 282da6123fd4
line source
1 #include <assert.h>
2 #include "opengl.h"
3 #include "app.h"
5 bool app_init()
6 {
7 if(!init_opengl()) {
8 return false;
9 }
10 return true;
11 }
13 void app_shutdown()
14 {
15 }
17 void app_display()
18 {
19 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
22 swap_buffers();
23 assert(glGetError() == GL_NO_ERROR);
24 }
26 void app_reshape(int x, int y)
27 {
28 glViewport(0, 0, x, y);
30 glMatrixMode(GL_PROJECTION);
31 glLoadIdentity();
32 gluPerspective(50.0, (float)x / (float)y, 0.5, 500.0);
33 }
35 void app_keyboard(int key, bool pressed, int x, int y)
36 {
37 if(pressed) {
38 switch(key) {
39 case 27:
40 quit();
41 }
42 }
43 }
45 void app_mouse_button(int bn, bool pressed, int x, int y)
46 {
47 }
49 void app_mouse_motion(int x, int y)
50 {
51 }