summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-09-15 10:27:37 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-09-15 10:46:41 (GMT)
commitaf1cfbc945c7c01adea09d3d369699f4dd0daab9 (patch)
tree24a9f3e32e12955d2a1a725dc54d6e0604ed50bb /src/opengl
parentf60e8c21c1d031daa8984461f9e5a6988e3ce2e7 (diff)
downloadQt-af1cfbc945c7c01adea09d3d369699f4dd0daab9.zip
Qt-af1cfbc945c7c01adea09d3d369699f4dd0daab9.tar.gz
Qt-af1cfbc945c7c01adea09d3d369699f4dd0daab9.tar.bz2
Fixed rendering errors in blurpicker with -graphicssystem opengl
1) Need to transfer to brush drawing mode when switching active engine, to make sure we reset the vertex / texture coordinate pointers for image drawing. 2) QGLPixmapGLPaintDevice::beginPaint() was changed to use QGLContext::drawTexture() for blitting the old texture contents to the render FBO, which means that we also need to set up viewport, modelview, and projection matrices, and ensure that clipping / stencil testing is disabled. 3) Make sure stencil testing is disabled when clearing the FBO. Reviewed-by: Tom
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp1
-rw-r--r--src/opengl/qpixmapdata_gl.cpp16
2 files changed, 16 insertions, 1 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 5e790cf..e41d0b4 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1385,6 +1385,7 @@ void QGL2PaintEngineEx::ensureActive()
d->device->ensureActiveTarget();
if (d->needsSync) {
+ d->transferMode(BrushDrawingMode);
glViewport(0, 0, d->width, d->height);
glDepthMask(false);
glDepthFunc(GL_LESS);
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 0bc46e1..d5398a9 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -149,6 +149,7 @@ void QGLPixmapGLPaintDevice::beginPaint()
if (data->needsFill()) {
const QColor &c = data->fillColor();
float alpha = c.alphaF();
+ glDisable(GL_SCISSOR_TEST);
glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
glClear(GL_COLOR_BUFFER_BIT);
}
@@ -157,8 +158,21 @@ void QGLPixmapGLPaintDevice::beginPaint()
// uploaded from an image or rendered into before), we need to
// copy it from the texture to the render FBO.
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_BLEND);
+
+ glMatrixMode(GL_MODELVIEW_MATRIX);
+ glLoadIdentity();
+
+ glMatrixMode(GL_PROJECTION_MATRIX);
+ glLoadIdentity();
+ glOrtho(0, data->width(), data->height(), 0, -999999, 999999);
+
+ glViewport(0, 0, data->width(), data->height());
+
// Pass false to bind so it doesn't copy the FBO into the texture!
- context()->drawTexture(QPointF(0.0, 0.0), data->bind(false));
+ context()->drawTexture(QRect(0, 0, data->width(), data->height()), data->bind(false));
}
}