vrfileman
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/app.cc Fri Jan 30 12:25:16 2015 +0200 1.3 @@ -0,0 +1,51 @@ 1.4 +#include <assert.h> 1.5 +#include "opengl.h" 1.6 +#include "app.h" 1.7 + 1.8 +bool app_init() 1.9 +{ 1.10 + if(!init_opengl()) { 1.11 + return false; 1.12 + } 1.13 + return true; 1.14 +} 1.15 + 1.16 +void app_shutdown() 1.17 +{ 1.18 +} 1.19 + 1.20 +void app_display() 1.21 +{ 1.22 + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1.23 + 1.24 + 1.25 + swap_buffers(); 1.26 + assert(glGetError() == GL_NO_ERROR); 1.27 +} 1.28 + 1.29 +void app_reshape(int x, int y) 1.30 +{ 1.31 + glViewport(0, 0, x, y); 1.32 + 1.33 + glMatrixMode(GL_PROJECTION); 1.34 + glLoadIdentity(); 1.35 + gluPerspective(50.0, (float)x / (float)y, 0.5, 500.0); 1.36 +} 1.37 + 1.38 +void app_keyboard(int key, bool pressed, int x, int y) 1.39 +{ 1.40 + if(pressed) { 1.41 + switch(key) { 1.42 + case 27: 1.43 + quit(); 1.44 + } 1.45 + } 1.46 +} 1.47 + 1.48 +void app_mouse_button(int bn, bool pressed, int x, int y) 1.49 +{ 1.50 +} 1.51 + 1.52 +void app_mouse_motion(int x, int y) 1.53 +{ 1.54 +}