[Interest] QOpenGLWidget and text

Adam Light aclight at gmail.com
Mon Apr 6 15:02:11 CEST 2015


On Sat, Apr 4, 2015 at 2:57 AM, Till Oliver Knoll <
till.oliver.knoll at gmail.com> wrote:

>
> >> ...
> >>
> >> That's the way to draw "over OpenGL" - not with a restricted "drawText"
> convenience method which happened to be placed in some random API
> (QGLWidget) over a decade ago ;)
> >
> > The problem is I don't *want* to draw "over" GLĀ¹. I *need* to draw *in*
> > GL, specifically I need to specify the text location in terms of the GL
> > modelview space.
> > ...
> > Overpainting techniques are fine... *for overpainting*. That's not what
> > I'm doing.
>
> Clearly I cannot predict your application's requirements, but
> "overpainting", that's exactly what you were doing apparently, all the
> time. You said so yourself, you were using
>
>  http://doc.qt.io/qt-4.8/qglwidget.html#renderText
>
> I've never used this method myself, but from what I gather you specify the
> text coordinates in /window/ coordinates - /not/ world (or model)
> coordinates!
>
> So all the "renderText" does is it "overpaints" the given text into the
> current GL buffer (by disabling the depth test).
>
> You get exactly the same result (probably even a better one due to better
> anti-aliasing) by using a QPainter and "overpaint" at the same window
> coordinates.
>
> So this method did not do what you now tell us what your requirements are.
> So one reason more to quickly remove it (before people come and request to
> please extend the API such that the coordinates could be specified also in
> model/world coordinates ;)).
>

I think you missed this overload of renderText:
http://doc.qt.io/qt-4.8/qglwidget.html#renderText-2

This takes object coordinates, including a z value.

The removal of this overload of renderText() was a significant blow to our
efforts in moving from 4.8 to 5.

Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150406/bf00b3d0/attachment.html>


More information about the Interest mailing list