orient the fbo rendering the same way as other fbo rendering and enable multisampling
authorGunnar Sletta <gunnar.sletta@nokia.com>
Sun, 11 Sep 2011 06:54:05 +0000 (08:54 +0200)
committerYoann Lopes <yoann.lopes@nokia.com>
Mon, 12 Sep 2011 09:19:22 +0000 (11:19 +0200)
Change-Id: Ibfb3bd9577efc50ca7654019638d22b9077df6bb
Reviewed-on: http://codereview.qt-project.org/4627
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Yoann Lopes <yoann.lopes@nokia.com>
src/declarative/scenegraph/util/qsgpainternode.cpp

index 90d66c0..5d54879 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "qsgpainteditem.h"
 #include <private/qsgcontext_p.h>
+#include <private/qopenglextensions_p.h>
 #include <qopenglframebufferobject.h>
 #include <qopenglfunctions.h>
 #include <qopenglpaintdevice.h>
@@ -148,8 +149,10 @@ void QSGPainterNode::paint()
     if (m_actualRenderTarget == QSGPaintedItem::Image)
         painter.begin(&m_image);
     else {
-        if (!m_gl_device)
+        if (!m_gl_device) {
             m_gl_device = new QOpenGLPaintDevice(m_fboSize);
+            m_gl_device->setPaintFlipped(true);
+        }
 
         if (m_multisampledFbo)
             m_multisampledFbo->bind();
@@ -230,7 +233,7 @@ void QSGPainterNode::updateGeometry()
     if (m_actualRenderTarget == QSGPaintedItem::Image)
         source = QRectF(0, 0, 1, 1);
     else
-        source = QRectF(0, 1, qreal(m_size.width()) / m_fboSize.width(), qreal(-m_size.height()) / m_fboSize.height());
+        source = QRectF(0, 0, qreal(m_size.width()) / m_fboSize.width(), qreal(m_size.height()) / m_fboSize.height());
     QSGGeometry::updateTexturedRectGeometry(&m_geometry,
                                             QRectF(0, 0, m_size.width(), m_size.height()),
                                             source);
@@ -280,7 +283,7 @@ void QSGPainterNode::updateRenderTarget()
             {
                 QOpenGLFramebufferObjectFormat format;
                 format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
-                format.setSamples(ctx->format().samples());
+                format.setSamples(8);
                 m_multisampledFbo = new QOpenGLFramebufferObject(m_fboSize, format);
             }
             {