diff options
author | Trond Kjernåsen <trond@trolltech.com> | 2010-01-27 11:46:23 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond@trolltech.com> | 2010-01-27 11:49:00 (GMT) |
commit | 15f690e6890caae8d0c000bcc34103b1841307eb (patch) | |
tree | c70332f30cc723ac4041d3839b9dace8582e8457 /src/opengl | |
parent | 878bf8b1dde10e28d9acd91002fd7b4e2a7a64e0 (diff) | |
download | Qt-15f690e6890caae8d0c000bcc34103b1841307eb.zip Qt-15f690e6890caae8d0c000bcc34103b1841307eb.tar.gz Qt-15f690e6890caae8d0c000bcc34103b1841307eb.tar.bz2 |
Added a warning to QGLWidget::renderText().
renderText() can't be used while a GL 2 paint engine is active on the
same device, because it will clash with the GL 1 engine and wreck havoc.
We simply don't support that scenario.
Task-number: QTBUG-7592
Reviewed-by: Samuel
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qgl.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 48e43b2..2a60708 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4419,8 +4419,17 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font, bool auto_swap = autoBufferSwap(); QPaintEngine::Type oldEngineType = qgl_engine_selector()->preferredPaintEngine(); - qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL); + QPaintEngine *engine = paintEngine(); + if (engine && (oldEngineType == QPaintEngine::OpenGL2) && engine->isActive()) { + qWarning("QGLWidget::renderText(): Calling renderText() while a GL 2 paint engine is" + " active on the same device is not allowed."); + return; + } + + // this changes what paintEngine() returns + qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL); + engine = paintEngine(); QPainter *p; bool reuse_painter = false; if (engine->isActive()) { @@ -4513,8 +4522,17 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con win_y = height - win_y; // y is inverted QPaintEngine::Type oldEngineType = qgl_engine_selector()->preferredPaintEngine(); - qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL); QPaintEngine *engine = paintEngine(); + + if (engine && (oldEngineType == QPaintEngine::OpenGL2) && engine->isActive()) { + qWarning("QGLWidget::renderText(): Calling renderText() while a GL 2 paint engine is" + " active on the same device is not allowed."); + return; + } + + // this changes what paintEngine() returns + qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL); + engine = paintEngine(); QPainter *p; bool reuse_painter = false; bool use_depth_testing = glIsEnabled(GL_DEPTH_TEST); |