summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-01 13:04:26 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-01 13:04:26 (GMT)
commit11d2c8f96697adc93ccd82e3db1de6ecde025eff (patch)
tree9ed5acfa397b093fd726742ae3c478c2f21223bc /src/opengl/qgl.cpp
parent1b4bb02fcb3da77ddfa6281365ba3210aab9daad (diff)
parentf3da2f414f9fce9aa014da79be9f50c075c60936 (diff)
downloadQt-11d2c8f96697adc93ccd82e3db1de6ecde025eff.zip
Qt-11d2c8f96697adc93ccd82e3db1de6ecde025eff.tar.gz
Qt-11d2c8f96697adc93ccd82e3db1de6ecde025eff.tar.bz2
Merge remote branch 'qt/4.6' into qt-master-from-4.6
Conflicts: src/gui/kernel/qeventdispatcher_mac.mm src/gui/kernel/qt_cocoa_helpers_mac.mm src/gui/widgets/qmenu_mac.mm tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp tools/assistant/tools/assistant/centralwidget.cpp tools/linguist/lupdate/main.cpp
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r--src/opengl/qgl.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index b7139a2..bb76f1a 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -4494,6 +4494,13 @@ static void qt_gl_draw_text(QPainter *p, int x, int y, const QString &str,
\note This function temporarily disables depth-testing when the
text is drawn.
+ \note This function can only be used inside a
+ QPainter::beginNativePainting()/QPainter::endNativePainting() block
+ if the default OpenGL paint engine is QPaintEngine::OpenGL. To make
+ QPaintEngine::OpenGL the default GL engine, call
+ QGL::setPreferredPaintEngine(QPaintEngine::OpenGL) before the
+ QApplication constructor.
+
\l{Overpainting Example}{Overpaint} with QPainter::drawText() instead.
*/
@@ -4513,8 +4520,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()) {
@@ -4607,8 +4623,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);