[Qt-interest] Drawing text over a QGLWidget
Donal O'Connor
donaloconnor at gmail.com
Wed Jan 27 17:49:53 CET 2010
After you've everything in your scene rendered in the paintGL method, you
should call renderText.
eg:
renderText(-20.0,-20.0,0.0,QString("Hi There"), QFont("Arial", 20, 5,
false));
and then to stop flickering,
place following lines after before end method:
swapBuffers();
glFlush();
On Wed, Jan 27, 2010 at 4:43 PM, Alan Norton <alan at ucar.edu> wrote:
> I would like to draw text at specified coordinates over an image
> rendered in a QGLWidget. This is in QT4.6.
> I want the text and the image to be visible at the same time.
> I tried using QPainter::drawText() in the paintGL() method, and in the
> PaintEvent() method. In the first case, the entire GL scene was
> overwritten. In the second case, the painting never stops, flickering
> all the time. Surely there is a "right" way to do this, but I couldn't
> see any examples of this. Any ideas are welcome.
> Thanks,
> -Alan Norton
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100127/8affcc49/attachment.html
More information about the Qt-interest-old
mailing list