[Interest] QOpenGLWidget and text

Allan Sandfeld Jensen kde at carewolf.com
Tue Apr 7 13:35:34 CEST 2015


On Monday 06 April 2015, Matthew Woehlke wrote:
> On 2015-04-06 12:40, Allan Sandfeld Jensen wrote:
> > On Monday 06 April 2015, Matthew Woehlke wrote:
> >> On 2015-04-04 05:57, Till Oliver Knoll wrote:
> >>> 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!
> >> 
> >> That is *one option*, and not the one I use. Look again; there is an
> >> overload that takes *world* coordinates. This is the one I use, and I
> >> can assure you it works.
> >> 
> >>> 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.
> >> 
> >> Actually, not better; exactly the same :-).
> > 
> > So why not use a QPainter?
> > 
> > QPainter p(qoglwidget);
> > p.renderText()?
> 
> Please read what you are replying to; as has been mentioned *several*
> times, one of the needs is to specify the location in GL world space,
> not screen space.
> 

QGLWidget::renderText is using QPainter. It disables depth test, sets a 
viewport and draws using qpainter. It is not a lot of code.

It is also not implemented for OpenGL/ES. It is  not the cleanest of neither 
API nor implementation.

`Allan



More information about the Interest mailing list