#include <openvr.h>
#include "openvrcombiner.h"
-#include "openvrdevice.h"
+#include "openvrsystem.h"
namespace Msp {
namespace VR {
};
-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;
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
compositor->Submit(vr::Eye_Left, &tex);
tex.handle = reinterpret_cast<void *>(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();
+ }
}