X-Git-Url: http://git.tdb.fi/?p=libs%2Fvr.git;a=blobdiff_plain;f=source%2Fopenvr%2Fopenvrcombiner.cpp;h=9bdf4b01a8151755a7f1ca3fa715c6dd96de9045;hp=2272a1a3509dad7b4667b49fb4a6c348d2026078;hb=c07c707c480f4e989caee17541187f08f136d216;hpb=c7e4d2226f16c8dfd9136eaa298fb0e6937ef125 diff --git a/source/openvr/openvrcombiner.cpp b/source/openvr/openvrcombiner.cpp index 2272a1a..9bdf4b0 100644 --- a/source/openvr/openvrcombiner.cpp +++ b/source/openvr/openvrcombiner.cpp @@ -11,8 +11,9 @@ struct OpenVRCombiner::Private }; -OpenVRCombiner::OpenVRCombiner(OpenVRDevice &d): - device(d) +OpenVRCombiner::OpenVRCombiner(OpenVRDevice &d, GL::View &v): + device(d), + view(v) { vr::IVRSystem *vr_sys = vr::VRSystem(); uint32_t w, h; @@ -23,6 +24,8 @@ OpenVRCombiner::OpenVRCombiner(OpenVRDevice &d): Frustum left_frustum = Private::get_projection(vr::Eye_Left); Frustum right_frustum = Private::get_projection(vr::Eye_Right); configure_eye_frustums(left_frustum, right_frustum); + + set_mirroring(true); } void OpenVRCombiner::prepare() const @@ -41,6 +44,13 @@ void OpenVRCombiner::render(const GL::Texture2D &left, const GL::Texture2D &righ compositor->Submit(vr::Eye_Left, &tex); tex.handle = reinterpret_cast(right.get_id()); compositor->Submit(vr::Eye_Right, &tex); + + if(mirror) + { + mirror->shdata.uniform("scale", view.get_aspect()/render_aspect/2, 0.5f); + render_mirror(left); + view.get_context().swap_buffers(); + } }