From 6c34517c3ed1bbfaeb394c16785581be31d2597f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= <tomi.korpipaa@theqtcompany.com> Date: Wed, 22 Apr 2015 11:47:32 +0300 Subject: [PATCH] Removed automatic viewport adjustment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3f3db246c4d5243cfe92bb1e7c3ed9223feebcf1 Task-number: QTBUG-45729 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> Reviewed-by: Pasi Keränen <pasi.keranen@digia.com> --- src/imports/qtcanvas3d/canvas3d.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/imports/qtcanvas3d/canvas3d.cpp b/src/imports/qtcanvas3d/canvas3d.cpp index f1f6213..bd1ff56 100644 --- a/src/imports/qtcanvas3d/canvas3d.cpp +++ b/src/imports/qtcanvas3d/canvas3d.cpp @@ -345,6 +345,14 @@ QJSValue Canvas::getContext(const QString &type, const QVariantMap &options) // Set the size and create FBOs setPixelSize(m_initializedSize); + m_displayFbo->bind(); + glViewport(0, 0, + m_fboSize.width(), + m_fboSize.height()); + m_renderFbo->bind(); + glViewport(0, 0, + m_fboSize.width(), + m_fboSize.height()); // Create the Context3D m_context3D = new CanvasContext(m_glContext, m_offscreenSurface, @@ -459,16 +467,11 @@ void Canvas::createFBOs() m_fboFormat); // Clear the FBOs to prevent random junk appearing on the screen + // Note: Viewport may not be changed automatically glClearColor(0,0,0,0); m_displayFbo->bind(); - glViewport(0, 0, - m_fboSize.width(), - m_fboSize.height()); glClear(GL_COLOR_BUFFER_BIT); m_renderFbo->bind(); - glViewport(0, 0, - m_fboSize.width(), - m_fboSize.height()); glClear(GL_COLOR_BUFFER_BIT); qCDebug(canvas3drendering).nospace() << "Canvas3D::" << __FUNCTION__ -- GitLab