1 From 7371d787d9b2667132c0caadb9964189b1d8c9fc Mon Sep 17 00:00:00 2001
2 From: Rhys Weatherley <rhys.weatherley@nokia.com>
3 Date: Thu, 17 Dec 2009 11:17:11 +1000
4 Subject: [PATCH 1136/1244] Disable depth testing during the 2D QGLWidget::renderText()
6 Also document the depth testing conditions for the 2D and 3D
7 versions of the function.
9 Task-number: QTBUG-5041
10 Reviewed-by: Daniel Pope
12 src/opengl/qgl.cpp | 12 ++++++++++++
13 1 files changed, 12 insertions(+), 0 deletions(-)
15 diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
16 index 32534aa..466e851 100644
17 --- a/src/opengl/qgl.cpp
18 +++ b/src/opengl/qgl.cpp
19 @@ -4302,6 +4302,7 @@ static void qt_save_gl_state()
20 glDisable(GL_CULL_FACE);
21 glDisable(GL_LIGHTING);
22 glDisable(GL_STENCIL_TEST);
23 + glDisable(GL_DEPTH_TEST);
25 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
27 @@ -4355,6 +4356,10 @@ static void qt_gl_draw_text(QPainter *p, int x, int y, const QString &str,
28 \note This function clears the stencil buffer.
30 \note This function is not supported on OpenGL/ES systems.
32 + \note This function temporarily disables depth-testing when the
35 \l{Overpainting Example}{Overpaint} with QPainter::drawText() instead.
38 @@ -4445,6 +4450,13 @@ void QGLWidget::renderText(int x, int y, const QString &str, const QFont &font,
39 have the labels move with the model as it is rotated etc.
41 \note This function is not supported on OpenGL/ES systems.
43 + \note If depth testing is enabled before this function is called,
44 + then the drawn text will be depth-tested against the models that
45 + have already been drawn in the scene. Use \c{glDisable(GL_DEPTH_TEST)}
46 + before calling this function to annotate the models without
47 + depth-testing the text.
49 \l{Overpainting Example}{Overpaint} with QPainter::drawText() instead.
51 void QGLWidget::renderText(double x, double y, double z, const QString &str, const QFont &font, int)