From bd4d69c9a88f476b4de4ba80945d39725bb29efa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Samuel=20R=C3=B8dal?= Date: Mon, 11 Jul 2011 12:35:43 +0200 Subject: [PATCH] Fixed rendering errors in complex particle system. We need to set the texture unit of the texture uniform as well, and we might as well set all the texture units in initialize() since they're constant. Change-Id: Ifcc690351ec7d1db1d98ab74644e248ec43cd328 Reviewed-on: http://codereview.qt.nokia.com/1410 Reviewed-by: Qt Sanity Bot Reviewed-by: Kim M. Kalland --- src/declarative/particles/qsgimageparticle.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp index a910cc6..aa73821 100644 --- a/src/declarative/particles/qsgimageparticle.cpp +++ b/src/declarative/particles/qsgimageparticle.cpp @@ -122,17 +122,15 @@ public: UltraMaterial *m = static_cast(newEffect); state.context()->functions()->glActiveTexture(GL_TEXTURE1); m->colortable->bind(); - program()->setUniformValue(m_colortable_id, 1); state.context()->functions()->glActiveTexture(GL_TEXTURE2); m->sizetable->bind(); - program()->setUniformValue(m_sizetable_id, 2); state.context()->functions()->glActiveTexture(GL_TEXTURE3); m->opacitytable->bind(); - program()->setUniformValue(m_opacitytable_id, 3); - state.context()->functions()->glActiveTexture(GL_TEXTURE0);//Investigate why this screws up Text{} if placed before 1 + // make sure we end by setting GL_TEXTURE0 as active texture + state.context()->functions()->glActiveTexture(GL_TEXTURE0); m->texture->bind(); program()->setUniformValue(m_opacity_id, state.opacity()); @@ -145,9 +143,11 @@ public: } virtual void initialize() { - m_colortable_id = program()->uniformLocation("colortable"); - m_sizetable_id = program()->uniformLocation("sizetable"); - m_opacitytable_id = program()->uniformLocation("opacitytable"); + program()->bind(); + program()->setUniformValue("texture", 0); + program()->setUniformValue("colortable", 1); + program()->setUniformValue("sizetable", 2); + program()->setUniformValue("opacitytable", 3); m_matrix_id = program()->uniformLocation("matrix"); m_opacity_id = program()->uniformLocation("opacity"); m_timestamp_id = program()->uniformLocation("timestamp"); @@ -178,9 +178,6 @@ public: int m_matrix_id; int m_opacity_id; int m_timestamp_id; - int m_colortable_id; - int m_sizetable_id; - int m_opacitytable_id; int m_framecount_id; int m_animcount_id; -- 2.7.4