diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-09-03 09:39:42 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-09-03 11:07:56 (GMT) |
commit | 0f0aaba318cd440e64eaf8fe0bef8e0004506309 (patch) | |
tree | 849e7396cff086a478a6ed199d4267373943eb2e /demos/composition | |
parent | d3673b331426346167e4dd1cd6c7b78ab7bf5176 (diff) | |
download | Qt-0f0aaba318cd440e64eaf8fe0bef8e0004506309.zip Qt-0f0aaba318cd440e64eaf8fe0bef8e0004506309.tar.gz Qt-0f0aaba318cd440e64eaf8fe0bef8e0004506309.tar.bz2 |
Made the composition demo work with the GL2 paint engine.
Task-number: 260686
Reviewed-by: Samuel
Diffstat (limited to 'demos/composition')
-rw-r--r-- | demos/composition/composition.cpp | 14 |
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 { |