X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fapp.cc;h=44c65fd1b150e9ebcf5a86282e159c69dcd883d4;hp=96e92f332ae7231d8e377801bfab2cc4dd106397;hb=2829b50d6b3d9e97fc9399f5b6929f7d64021366;hpb=197bafc7f54795243d4c217c2efcf41f01d4100d diff --git a/src/app.cc b/src/app.cc index 96e92f3..44c65fd 100644 --- a/src/app.cc +++ b/src/app.cc @@ -15,6 +15,7 @@ #include "opt.h" #include "post.h" #include "renderer.h" +#include "rtarg.h" #include "avatar.h" #include "vrinput.h" #include "exman.h" @@ -82,6 +83,7 @@ static ExhibitSlot exslot_left, exslot_right; #define exslot_mouse exslot_right static Renderer *rend; +static RenderTarget *goatvr_rtarg; static Ray last_pick_ray; @@ -123,6 +125,8 @@ bool app_init(int argc, char **argv) have_handtracking = goatvr_have_handtracking(); goatvr_recenter(); + + goatvr_rtarg = new RenderTarget; } if(fb_srgb) { @@ -222,6 +226,7 @@ void app_cleanup() app_grab_mouse(false); if(opt.vr) { + delete goatvr_rtarg; goatvr_shutdown(); } destroy_vrhands(); @@ -421,14 +426,20 @@ void app_display() goatvr_draw_start(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + unsigned int gfbo = goatvr_get_fbo(); + update(dt); for(int i=0; i<2; i++) { // for each eye goatvr_draw_eye(i); - if(goatvr_get_fb_texture()) { + if(gfbo) { vp_width = goatvr_get_fb_eye_width(i); vp_height = goatvr_get_fb_eye_height(i); + + // this is a lightweight operation + goatvr_rtarg->create_wrap_fbo(gfbo, vp_width, vp_height); + push_render_target(goatvr_rtarg, RT_FAKE); } else { vp_width = win_width / 2; } @@ -449,7 +460,12 @@ void app_display() if(debug_gui) { ImGui::Render(); } + + if(gfbo) { + pop_render_target(RT_FAKE); + } } + goatvr_draw_done(); vp_width = win_width;