X-Git-Url: http://git.tdb.fi/?p=libs%2Fvr.git;a=blobdiff_plain;f=source%2Fopenvr%2Fopenvrcombiner.cpp;h=85a0e2a2352df3ac557b5d0e8f9d3096e104921f;hp=2272a1a3509dad7b4667b49fb4a6c348d2026078;hb=a0a8e3a7c5a229dcccd1af3a3edeac5ba8156954;hpb=78598b41009aeabb7f9b4b4ddc05b68e7edd6eb6 diff --git a/source/openvr/openvrcombiner.cpp b/source/openvr/openvrcombiner.cpp index 2272a1a..85a0e2a 100644 --- a/source/openvr/openvrcombiner.cpp +++ b/source/openvr/openvrcombiner.cpp @@ -1,6 +1,6 @@ #include #include "openvrcombiner.h" -#include "openvrdevice.h" +#include "openvrsystem.h" namespace Msp { namespace VR { @@ -11,8 +11,9 @@ struct OpenVRCombiner::Private }; -OpenVRCombiner::OpenVRCombiner(OpenVRDevice &d): - device(d) +OpenVRCombiner::OpenVRCombiner(OpenVRSystem &d, GL::View &v): + system(d), + view(v) { vr::IVRSystem *vr_sys = vr::VRSystem(); uint32_t w, h; @@ -23,11 +24,14 @@ 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); + + view.get_context().set_swap_interval(0); + set_mirroring(true); } void OpenVRCombiner::prepare() const { - device.update_pose_matrices(); + system.update_pose_matrices(); } void OpenVRCombiner::render(const GL::Texture2D &left, const GL::Texture2D &right) const @@ -41,6 +45,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(); + } }