X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrfileman;a=blobdiff_plain;f=src%2Fapp.cc;h=c3f6b3928c57400a9f04490d01cf4f2c0f4b3b0f;hp=e9e4cbbe9de1f8b16fe29f3ebd8aecab85fa4e7b;hb=8afeabf06c79c755e5aaffa224e06c4abc92d833;hpb=b7ea5b1ae3f0f0a5eba13b49e303b49876ee209e diff --git a/src/app.cc b/src/app.cc index e9e4cbb..c3f6b39 100644 --- a/src/app.cc +++ b/src/app.cc @@ -12,6 +12,7 @@ int win_width, win_height; float win_aspect; long time_msec; +double time_sec; Mat4 view_matrix; static bool should_swap; @@ -28,6 +29,9 @@ bool app_init(int argc, char **argv) if(!init_options(argc, argv, 0)) { return false; } + app_resize(opt.width, opt.height); + app_fullscreen(opt.fullscreen); + if(init_opengl() == -1) { return false; } @@ -42,10 +46,8 @@ bool app_init(int argc, char **argv) glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); - //glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - if(GLEW_ARB_framebuffer_sRGB) { + if(opt.srgb && GLEW_ARB_framebuffer_sRGB) { printf("enabling sRGB framebuffer\n"); glEnable(GL_FRAMEBUFFER_SRGB); } @@ -127,6 +129,7 @@ void app_draw() draw_backdrop(); app_swap_buffers(); + app_redraw(); // since we added animation we need to redisplay even in non-VR mode } assert(glGetError() == GL_NO_ERROR); } @@ -140,6 +143,10 @@ void app_reshape(int x, int y) glMatrixMode(GL_PROJECTION); glLoadMatrixf(mat[0]); + + if(opt.vr) { + goatvr_set_fb_size(x, y, 1.0); + } } void app_keyboard(int key, bool pressed) @@ -150,6 +157,17 @@ void app_keyboard(int key, bool pressed) app_quit(); break; + case 'f': + if(!opt.vr || should_swap) { + /* we take the need to swap as a signal that our window is not managed + * by some VR compositor, and therefore it's safe to fullscreen without + * upsetting the VR rendering output + */ + opt.fullscreen = !opt.fullscreen; + app_fullscreen(opt.fullscreen); + } + break; + case ' ': if(opt.vr) { goatvr_recenter();