Important: Please read the Qt Code of Conduct -

QPainter text with OpengGLWidget problem

  • I'm trying to draw text with QPainter on top of an OpenGL scene. The first time the program comes up I can see everything ok, but if I move the mouse the opengl scene becomes fuzzy.

    You can see what I mean here:

    the code is available if anyone wants to try. I'm running this on Windows 7 with MinGW and MSVC (I get the same problem with both).

    Inside Sphere::paintEvent(QPaintEvent * event) I call paintGL() and then I create the painter object, this is how I've seen it done in other places but with this 3D scene I can't get it to work properly.

    Any thoughts?

  • I was able to fix this.

    I had to release the buffers in the OpenGL code and also use glDisable(GL_DEPTH_TEST) before using the painter. I've updated the code and it works perfectly.

Log in to reply