diff Applications/Samples/Common/RtViewerView.cpp @ 1594:74ed691f9c64

fix initial rendering of MPR sample
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 26 Oct 2020 15:52:11 +0100
parents 32e0c007789d
children 52b8b96cb55f
line wrap: on
line diff
--- a/Applications/Samples/Common/RtViewerView.cpp	Fri Oct 23 17:39:16 2020 +0200
+++ b/Applications/Samples/Common/RtViewerView.cpp	Mon Oct 26 15:52:11 2020 +0100
@@ -249,6 +249,14 @@
   void RtViewerView::PrepareViewport()
   {
     std::unique_ptr<IViewport::ILock> lock(viewport_->Lock());
+
+    /**
+     * The method "RefreshCanvasSize()" must be used before the first
+     * rendering, or when the layout of the HTML page changes, which
+     * does not trigger the "emscripten_set_resize_callback()" event
+     **/
+    lock->RefreshCanvasSize();
+    
     ViewportController& controller = lock->GetController();
     ICompositor& compositor = lock->GetCompositor();