summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
diff options
context:
space:
mode:
authorPulse Build System <qt-info@nokia.com>2010-01-27 06:54:29 (GMT)
committerPulse Build System <qt-info@nokia.com>2010-01-27 06:54:29 (GMT)
commitec90f6ed28ec735ce963c4257ea1095ecbc6c6ba (patch)
tree5a33a6c6a9893eaf9ce88dee36a976d46767327a /src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
parentd7d4abbcbf4f39a0b3d568af111c81be18d2a83a (diff)
parent416cf8a5a9384f942282a2c715ec4832eeba001d (diff)
downloadQt-ec90f6ed28ec735ce963c4257ea1095ecbc6c6ba.zip
Qt-ec90f6ed28ec735ce963c4257ea1095ecbc6c6ba.tar.gz
Qt-ec90f6ed28ec735ce963c4257ea1095ecbc6c6ba.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2: (33 commits) Compile with no-webkit - add missing semi-colons. Fixes visibility update missing when doing setParentItem on graphicsitem Stabilize tst_QGraphicsScene::polishItems2 (new test) Fixed an infinite loop that could occur when reading invalid BMP images. Updated docs regarding QGLWidget::renderText() limitations. Added optimization flag to QGraphicsItemPrivate. Fixed child items with graphics effects not inheriting opacity. Made the trace replayer handle limited resolution cases better. Small optimization in raster paint engine. Another ASSERT while deleting spans Implement QDirectFBPixmapData::scroll Potential crash when adding items from QGraphicsWidget::polishEvent(). QGraphicsWidget is painted twice on the inital show. Fix QPainter::redirection() to pass autotest. Re-added the Close button in QPrintPreviewDialog for Mac/Carbon. revert parts of 10392eef4fd4f9 Fix y-inverted pixmaps properly. Fix rendering with simple shader in GL2 engine removed a debug trace Fix documentation bug in QColor ...
Diffstat (limited to 'src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index caa679b..b282676 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -168,12 +168,6 @@ void QGL2PaintEngineExPrivate::useSimpleShader()
if (matrixDirty)
updateMatrix();
-
- if (simpleShaderMatrixUniformDirty) {
- const GLuint location = shaderManager->simpleProgram()->uniformLocation("pmvMatrix");
- glUniformMatrix3fv(location, 1, GL_FALSE, (GLfloat*)pmvMatrix);
- simpleShaderMatrixUniformDirty = false;
- }
}
void QGL2PaintEngineExPrivate::updateBrushTexture()
@@ -392,9 +386,11 @@ void QGL2PaintEngineExPrivate::updateMatrix()
matrixDirty = false;
- // The actual data has been updated so both shader program's uniforms need updating
- simpleShaderMatrixUniformDirty = true;
- shaderMatrixUniformDirty = true;
+ // Set the PMV matrix attribute. As we use an attributes rather than uniforms, we only
+ // need to do this once for every matrix change and persists across all shader programs.
+ glVertexAttrib3fv(QT_PMV_MATRIX_1_ATTR, pmvMatrix[0]);
+ glVertexAttrib3fv(QT_PMV_MATRIX_2_ATTR, pmvMatrix[1]);
+ glVertexAttrib3fv(QT_PMV_MATRIX_3_ATTR, pmvMatrix[2]);
dasher.setInvScale(inverseScale);
stroker.setInvScale(inverseScale);
@@ -932,18 +928,12 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
if (changed) {
// The shader program has changed so mark all uniforms as dirty:
brushUniformsDirty = true;
- shaderMatrixUniformDirty = true;
opacityUniformDirty = true;
}
if (brushUniformsDirty && mode != ImageDrawingMode && mode != ImageArrayDrawingMode)
updateBrushUniforms();
- if (shaderMatrixUniformDirty) {
- glUniformMatrix3fv(location(QGLEngineShaderManager::PmvMatrix), 1, GL_FALSE, (GLfloat*)pmvMatrix);
- shaderMatrixUniformDirty = false;
- }
-
if (opacityMode == QGLEngineShaderManager::UniformOpacity && opacityUniformDirty) {
shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::GlobalOpacity), (GLfloat)q->state()->opacity);
opacityUniformDirty = false;
@@ -1955,11 +1945,8 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state)
if (old_state == s || old_state->renderHintsChanged)
renderHintsChanged();
- if (old_state == s || old_state->matrixChanged) {
+ if (old_state == s || old_state->matrixChanged)
d->matrixDirty = true;
- d->simpleShaderMatrixUniformDirty = true;
- d->shaderMatrixUniformDirty = true;
- }
if (old_state == s || old_state->compositionModeChanged)
d->compositionModeDirty = true;