+ for(int i=0; i<2; i++) {
+ goatvr_draw_eye(i);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadMatrixf(goatvr_projection_matrix(i, 0.1, 200.0));
+
+ view_matrix = goatvr_view_matrix(i);
+ view_matrix.pre_rotate_x(deg_to_rad(cam_phi));
+ view_matrix.pre_rotate_y(deg_to_rad(cam_theta));
+ view_matrix.pre_translate(0, -cam_height, 0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadMatrixf(view_matrix[0]);
+
+ draw_scene();
+ }
+ goatvr_draw_done();
+
+ if(should_swap) {
+ app_swap_buffers();
+ }
+ app_redraw(); // in VR mode, force continuous redraw
+
+ } else {
+ // regular monoscopic mode
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ Mat4 mat;
+ mat.perspective(deg_to_rad(fov), win_aspect, 0.1, 200.0);
+ glMatrixMode(GL_PROJECTION);
+ glLoadMatrixf(mat[0]);