]> git.tdb.fi Git - libs/vr.git/blobdiff - source/sidebysidecombiner.cpp
Update camera pose as part of the render call
[libs/vr.git] / source / sidebysidecombiner.cpp
index 213b5448249b894736d392e55c741235d10e438b..b1b8f9db06ed2e25537164bf0d4459b943dd0a76 100644 (file)
@@ -26,11 +26,14 @@ const char fs_source[] =
 namespace Msp {
 namespace VR {
 
-SideBySideCombiner::SideBySideCombiner(bool c):
+SideBySideCombiner::SideBySideCombiner(GL::View &v, bool c):
+       view(v),
        mesh(GL::VERTEX2),
        shprog(vs_source, fs_source)
 {
-       width_div = 2;
+       target_width = view.get_width()/2;
+       target_height = view.get_height()/2;
+       render_aspect = static_cast<float>(target_width)/target_height;
 
        left_shdata.uniform("texture", 0);
        right_shdata.uniform("texture", 0);
@@ -65,6 +68,8 @@ void SideBySideCombiner::render(const GL::Texture2D &left, const GL::Texture2D &
        right.bind();
        right_shdata.apply();
        mesh.draw();
+
+       view.get_context().swap_buffers();
 }
 
 } // namespace VR