X-Git-Url: http://git.tdb.fi/?p=libs%2Fvr.git;a=blobdiff_plain;f=source%2Fsidebysidecombiner.cpp;h=b1b8f9db06ed2e25537164bf0d4459b943dd0a76;hp=c5aef041ecf3f123501d9fc062d5c497f1abe1de;hb=c7e4d2226f16c8dfd9136eaa298fb0e6937ef125;hpb=b17410965e84e378c4cc85ffb732365552edc584 diff --git a/source/sidebysidecombiner.cpp b/source/sidebysidecombiner.cpp index c5aef04..b1b8f9d 100644 --- a/source/sidebysidecombiner.cpp +++ b/source/sidebysidecombiner.cpp @@ -26,12 +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_factor = 0.5f; - aspect_factor = 0.5f; + target_width = view.get_width()/2; + target_height = view.get_height()/2; + render_aspect = static_cast(target_width)/target_height; left_shdata.uniform("texture", 0); right_shdata.uniform("texture", 0); @@ -66,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