aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/particles
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-07-11 12:35:43 +0200
committerQt by Nokia <qt-info@nokia.com>2011-07-11 13:04:08 +0200
commitbd4d69c9a88f476b4de4ba80945d39725bb29efa (patch)
treedba476c334defa157565e8e2a3bf08bbca876a95 /src/declarative/particles
parent9acb4b4f787882e989e4e0c751fb9c1657fe2106 (diff)
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 <qt_sanity_bot@ovi.com> Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
Diffstat (limited to 'src/declarative/particles')
-rw-r--r--src/declarative/particles/qsgimageparticle.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/declarative/particles/qsgimageparticle.cpp b/src/declarative/particles/qsgimageparticle.cpp
index a910cc6b89..aa7382190d 100644
--- a/src/declarative/particles/qsgimageparticle.cpp
+++ b/src/declarative/particles/qsgimageparticle.cpp
@@ -122,17 +122,15 @@ public:
UltraMaterial *m = static_cast<UltraMaterial *>(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;