Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPainter text with OpengGLWidget problem
Forum Updated to NodeBB v4.3 + New Features

QPainter text with OpengGLWidget problem

Scheduled Pinned Locked Moved General and Desktop
qpainterqopenglwidget
2 Posts 1 Posters 935 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spacemig
    wrote on last edited by
    #1

    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:
    https://bitbucket.org/spacemig/earth3d

    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?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      spacemig
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved