+ if(use_vr) {
+ // VR mode
+ goatvr_draw_start();
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ for(int i=0; i<2; i++) {
+ goatvr_draw_eye(i);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadMatrixf(goatvr_projection_matrix(i, 0.5, 1000.0));
+
+ Mat4 view_mat = goatvr_view_matrix(i);
+ view_mat.pre_rotate_x(deg_to_rad(cam_phi));
+ view_mat.pre_rotate_y(deg_to_rad(cam_theta));
+ view_mat.pre_translate(0, -cam_height, 0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadMatrixf(view_mat[0]);
+
+ draw_backdrop();
+ }
+ 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);