fixed mirror rendering for goatvr backends which don't use an fbo
[laserbrain_demo] / src / app.cc
index ee9b5e6..96e92f3 100644 (file)
@@ -183,6 +183,11 @@ bool app_init(int argc, char **argv)
        if(!rend->init()) {
                return false;
        }
+       if(opt.reflect) {
+               rend->ropt |= RENDER_MIRRORS;
+       } else {
+               rend->ropt &= ~RENDER_MIRRORS;
+       }
        rend->set_scene(mscn);
 
        glUseProgram(0);
@@ -421,8 +426,12 @@ void app_display()
                for(int i=0; i<2; i++) {
                        // for each eye
                        goatvr_draw_eye(i);
-                       vp_width = goatvr_get_fb_eye_width(i);
-                       vp_height = goatvr_get_fb_eye_height(i);
+                       if(goatvr_get_fb_texture()) {
+                               vp_width = goatvr_get_fb_eye_width(i);
+                               vp_height = goatvr_get_fb_eye_height(i);
+                       } else {
+                               vp_width = win_width / 2;
+                       }
 
                        proj_matrix = goatvr_projection_matrix(i, NEAR_CLIP, FAR_CLIP);
                        glMatrixMode(GL_PROJECTION);