From 0f0aaba318cd440e64eaf8fe0bef8e0004506309 Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 3 Sep 2009 11:39:42 +0200 Subject: Made the composition demo work with the GL2 paint engine. Task-number: 260686 Reviewed-by: Samuel --- demos/composition/composition.cpp | 14 +++++++++++--- 1 file 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 { -- cgit v0.12