Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QPainter::drawText display corrupted text on a QOpenGLWidget
Alain38 0 last edited by Alain38 0
I have a QOpenGLWidget. This widget is used to display different elements:
a background image (OpenGL texture),
a list of selected pixels (OpenGL texture displayed on the background)
A text displaying the distance between two selected pixels (QPainter::drawText)
All OpenGL drawing are enclosed by a beginNativePainting/EndNativePainting. But I have a strange behavior on the text drawing.
At the beginning of the application, when the layer with selected pixels has not yet been displayed, if I'm using the measure tool, text is correctly displayed and still be correctly displayed once the selected pixels layer is activated.
But, if I start the application, activate the display of the selected pixels layer, and then use my measure tool, displayed text is corrupted. And it is no more possible to have a correct display (even with the selected pixels layer disabled). The text is displayed has in the below image:
In fact this text looks like I had a shift between each pixel row. Any ideo of the origin of this problem?
Alain38 0 last edited by
Problem found. In my program I have a line
As long as the layer is not displayed, this line is not executed. So, once active, I supposes that it has a side effect on the loading of the glyphs. Once glyphs are loaded with standard alignment everything works well. But, with a byte alignment something is broken.
Now it is not normal that a call to an OpenGL function changes the way glyphs are loaded.
Glad you found out and thanks for sharing !
What version of Qt are you using ?
On which platform ?
Did you check the bug report system to see if it's something known ?