I’m using Qt 5.2, on Windows 7, MinGW 32 bit version. I’m trying to overlay some 2d text over an OpenGL 3.3 context using QPainter.

Here’s the code I’m using to set up the font:
Qt Code:
  1. m_font = QFont ("Times", 15, QFont::Light, true);
To copy to clipboard, switch view to plain text mode 

Here’s the code I’m using for drawing:
Qt Code:
  1. if (!m_paintDevice){
  2. m_paintDevice = new QOpenGLPaintDevice;
  3. }
  4.  
  5. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  6.  
  7. m_paintDevice->setSize(size());
  8.  
  9. QPainter painter(m_paintDevice);
  10. painter.setRenderHint(QPainter::Antialiasing);
  11. painter.beginNativePainting();
  12.  
  13. // OpenGL draw calls go here.
  14.  
  15. painter.endNativePainting();
  16.  
  17. m_defaultPen.setColor(Qt::white);
  18.  
  19. painter.setPen(m_defaultPen);
  20. painter.setFont(m_font);
  21. painter.drawText(m_defaultRect, Qt::AlignCenter, "This is a test.");
To copy to clipboard, switch view to plain text mode 

All other code is pretty much identical to the example found here https://qt-project.org/doc/qt-5.0/qt...nglwindow.html.

This is the result I’m getting:
mGVoBeT.png

I’ve tried multiple different font families (Arial, Compacta, etc.), yet this problem persisted. The only thing that can slightly mitigate it, is the increase in QFont size (50+ has little to none of these distortions).

Does anyone know how to solve this problem?