Important: Please read the Qt Code of Conduct -

How to render text in OpenGL context

  • I want to render a text in OpenGL context with painter, but from the document, qt will disable depth test inside the beginNativePainting and endNativePainting pair, so the text in the back of object will be painted in the front of the object, like that:

    WeChat Image_20200218160929.png

    My opengl widget is inherited from QOpenGLWidget, please help me how to draw a text in this opengl contect.

Log in to reply