#include "opt.h"
#include "post.h"
#include "renderer.h"
+#include "rtarg.h"
#include "avatar.h"
#include "vrinput.h"
#include "exman.h"
#define exslot_mouse exslot_right
static Renderer *rend;
+static RenderTarget *goatvr_rtarg;
static Ray last_pick_ray;
have_handtracking = goatvr_have_handtracking();
goatvr_recenter();
+
+ goatvr_rtarg = new RenderTarget;
}
if(fb_srgb) {
app_grab_mouse(false);
if(opt.vr) {
+ delete goatvr_rtarg;
goatvr_shutdown();
}
destroy_vrhands();
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);
- vp_width = goatvr_get_fb_eye_width(i);
- vp_height = goatvr_get_fb_eye_height(i);
+ 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;
+ }
proj_matrix = goatvr_projection_matrix(i, NEAR_CLIP, FAR_CLIP);
glMatrixMode(GL_PROJECTION);
if(debug_gui) {
ImGui::Render();
}
+
+ if(gfbo) {
+ pop_render_target(RT_FAKE);
+ }
}
+
goatvr_draw_done();
vp_width = win_width;