[Interest] QOpenGLWidget and text

Matthew Woehlke mw_triad at users.sourceforge.net
Fri Apr 3 17:26:01 CEST 2015


On 2015-04-02 13:45, Till Oliver Knoll wrote:
>> Am 01.04.2015 um 20:39 schrieb Matthew Woehlke:
>>> On 2015-04-01 10:28, Giuseppe D'Angelo wrote:
>>> Il 01/04/2015 15:42, Matthew Woehlke ha scritto:
>>>> If I go the route of pre-rendering the text into a QImage, what is the
>>>> easiest way, using only the modern QOpenGL classes (since there is no
>>>> longer bindTexture either), to get that into an OpenGL texture?
>>>
>>> A rough game plan is this:
>>> [snip really lengthy process]
>>>
>>> Isn't Modern OpenGL lovely? ;)
>>
>> Can someone please explain to me how this is an improvement over having
>> a renderText() method?
> 
> Sure, having a "drawText" function is /very/ convenient. Likely a
> "bindTexture" function. But what's next? A "drawButton"? "drawBitmap"?
> In a Widget?!

Yes. And why not? QGraphicsView already does this sort of thing. (Well,
it wouldn't be literally "drawButton", but I can readily imagine Qt
sprouting an easy and convenient way to render a QWidget in a 3D
scene... either as "truly" 3D geometry, i.e. transformed and scaled, or
billboarded and rendered at fixed pixel size, but potentially still
using the GL depth buffer. I'm not even sure what Qt3D can't *already*
do this.)

> In fact, someone already pointed out that you can use a QPainter and "draw over the OpenGL rendered scene".
>
> 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.

(¹ Well, I have another use case that *is* drawing over, but I already
was using QPainter for that.)

Overpainting techniques are fine... *for overpainting*. That's not what
I'm doing.

-- 
Matthew




More information about the Interest mailing list