summaryrefslogtreecommitdiffstats
path: root/demos/composition
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-09-04 00:28:26 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-09-04 00:28:26 (GMT)
commit72cca6fe7739c7b5ccd5fc17fb3e1913cc82dce1 (patch)
tree4de2902aba198d339a2ea75d14bbc3d2b2d11723 /demos/composition
parent9e57401d403ca31a880636ab91301158a085de09 (diff)
parent4c501d7fce503a610edabfba5d6efc3ef2778bef (diff)
downloadQt-72cca6fe7739c7b5ccd5fc17fb3e1913cc82dce1.zip
Qt-72cca6fe7739c7b5ccd5fc17fb3e1913cc82dce1.tar.gz
Qt-72cca6fe7739c7b5ccd5fc17fb3e1913cc82dce1.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'demos/composition')
-rw-r--r--demos/composition/composition.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/demos/composition/composition.cpp b/demos/composition/composition.cpp
index bb8a02c..8061908 100644
--- a/demos/composition/composition.cpp
+++ b/demos/composition/composition.cpp
@@ -377,7 +377,9 @@ void CompositionRenderer::paint(QPainter *painter)
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(QRect(0, 0, m_pbuffer->width(), m_pbuffer->height()), Qt::transparent);
- p.save();
+ p.save(); // Needed when using the GL1 engine
+ p.beginNativePainting(); // Needed when using the GL2 engine
+
glBindTexture(GL_TEXTURE_2D, m_base_tex);
glEnable(GL_TEXTURE_2D);
glColor4f(1.,1.,1.,1.);
@@ -399,16 +401,21 @@ void CompositionRenderer::paint(QPainter *painter)
glEnd();
glDisable(GL_TEXTURE_2D);
- p.restore();
+
+ p.endNativePainting(); // Needed when using the GL2 engine
+ p.restore(); // Needed when using the GL1 engine
drawSource(p);
p.end();
m_pbuffer->updateDynamicTexture(m_compositing_tex);
}
- glWidget()->makeCurrent();
+ painter->beginNativePainting(); // Needed when using the GL2 engine
+ glWidget()->makeCurrent(); // Needed when using the GL1 engine
glBindTexture(GL_TEXTURE_2D, m_compositing_tex);
glEnable(GL_TEXTURE_2D);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1.,1.,1.,1.);
glBegin(GL_QUADS);
{
@@ -426,6 +433,7 @@ void CompositionRenderer::paint(QPainter *painter)
}
glEnd();
glDisable(GL_TEXTURE_2D);
+ painter->endNativePainting(); // Needed when using the GL2 engine
} else
#endif
{