Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, April 2007
Rendering OpenGL Text


Message 1 in thread

I have been informed on numerous occasions that using
GLWidget::renderText is a bad idea.  However, in looking through the
QT4.3 code it looks like this happens by doing a glUnproject on the 3d
coordinates and then drawing the label using a QPainter.  Is this really
so bad?  What ARE the downfalls of using renderText?

In my own code under paintGL (and i know this may be the wrong spot) i
tried doing a QPainter p(this) and then drawing my own text.  However
when "i" attempt to do this i get a segfault.  

From the QT4 source it looks like in renderText they are doing some
"magic" like disabling glClear() while painting etc.  They are also
disabling AutoBufferSwap.  What I don't get is why when "i" create my
own QPainter i get a segfault but when their code does it, they don't. 

Also my question is the preferred way to render text.  Is it to paint on
top of my widget with a painter?  I'd kinda like it to be rendered in
the 3d environment so that as i zoom / rotate the size changes with the
perspective.

The other way that i attempted to do this was to using a QGLPixelBuffer
and then doing an updateDynamicTexture but in this case it ends up
showing the background from the pixelbuffer in the texture.  I'd need to
have a way that makes the background transparent.  

I'm having a hell of a time is the summary.  Any info is much
appreciated.

-Donald

--
 [ signature omitted ] 

Message 2 in thread

Have you thought of using an external lib?
FTGL [1] seems to be a good option for various platforms, and it allows you to draw 3D text in 3D 
space..

manu

[1] http://homepages.paradise.net.nz/henryj/code/#FTGL


Donald Ephraim Curtis wrote:
> I have been informed on numerous occasions that using
> GLWidget::renderText is a bad idea.  However, in looking through the
> QT4.3 code it looks like this happens by doing a glUnproject on the 3d
> coordinates and then drawing the label using a QPainter.  Is this really
> so bad?  What ARE the downfalls of using renderText?
> 
> In my own code under paintGL (and i know this may be the wrong spot) i
> tried doing a QPainter p(this) and then drawing my own text.  However
> when "i" attempt to do this i get a segfault.  
> 
> From the QT4 source it looks like in renderText they are doing some
> "magic" like disabling glClear() while painting etc.  They are also
> disabling AutoBufferSwap.  What I don't get is why when "i" create my
> own QPainter i get a segfault but when their code does it, they don't. 
> 
> Also my question is the preferred way to render text.  Is it to paint on
> top of my widget with a painter?  I'd kinda like it to be rendered in
> the 3d environment so that as i zoom / rotate the size changes with the
> perspective.
> 
> The other way that i attempted to do this was to using a QGLPixelBuffer
> and then doing an updateDynamicTexture but in this case it ends up
> showing the background from the pixelbuffer in the texture.  I'd need to
> have a way that makes the background transparent.  
> 
> I'm having a hell of a time is the summary.  Any info is much
> appreciated.
> 
> -Donald
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 3 in thread

My only concern would be with having another dependancy.  I'm sure it's
not very big etc.  Plus i'm also curious if there is a really simple way
that i'm missing.

(Tue, Apr 03, 2007 at 10:30:03PM +0200) Manuela Hutter <manuela.hutter@xxxxxx>:
> Have you thought of using an external lib?
> FTGL [1] seems to be a good option for various platforms, and it allows you 
> to draw 3D text in 3D space..
> 
> manu
> 
> [1] http://homepages.paradise.net.nz/henryj/code/#FTGL
> 
> 
> Donald Ephraim Curtis wrote:
> >I have been informed on numerous occasions that using
> >GLWidget::renderText is a bad idea.  However, in looking through the
> >QT4.3 code it looks like this happens by doing a glUnproject on the 3d
> >coordinates and then drawing the label using a QPainter.  Is this really
> >so bad?  What ARE the downfalls of using renderText?
> >
> >In my own code under paintGL (and i know this may be the wrong spot) i
> >tried doing a QPainter p(this) and then drawing my own text.  However
> >when "i" attempt to do this i get a segfault.  
> >
> >From the QT4 source it looks like in renderText they are doing some
> >"magic" like disabling glClear() while painting etc.  They are also
> >disabling AutoBufferSwap.  What I don't get is why when "i" create my
> >own QPainter i get a segfault but when their code does it, they don't. 
> >
> >Also my question is the preferred way to render text.  Is it to paint on
> >top of my widget with a painter?  I'd kinda like it to be rendered in
> >the 3d environment so that as i zoom / rotate the size changes with the
> >perspective.
> >
> >The other way that i attempted to do this was to using a QGLPixelBuffer
> >and then doing an updateDynamicTexture but in this case it ends up
> >showing the background from the pixelbuffer in the texture.  I'd need to
> >have a way that makes the background transparent.  
> >
> >I'm having a hell of a time is the summary.  Any info is much
> >appreciated.
> >
> >-Donald
> >
> >--
> >To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> >"unsubscribe" in the subject or the body.
> >List archive and information: http://lists.trolltech.com/qt-interest/
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
> 

--
 [ signature omitted ] 

Message 4 in thread

As far as i know it's not allowed to render on top of a  gl 
rendering-context with standard windows gdi functions. I bet this is the 
same case for other operating systems. some operating systems have 
special functionality for bitmap text rendering. On windows platforms 
you have the wgl extensions in the win32 api. tho this is a bad choice 
since it's os dependent. The fastest and probably the best way to render 
text in an opengl based application is to render the text with skinned 
polygons.

The following code outlines the idea quite good. Tho the code is awfull ^^
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=17

Another variant is to do it without a display list. You could improve 
this version by taking the actual width of the font in consideration.

best regards
johannes

Donald Ephraim Curtis schrieb:
> My only concern would be with having another dependancy.  I'm sure it's
> not very big etc.  Plus i'm also curious if there is a really simple way
> that i'm missing.
>
> (Tue, Apr 03, 2007 at 10:30:03PM +0200) Manuela Hutter <manuela.hutter@xxxxxx>:
>   
>> Have you thought of using an external lib?
>> FTGL [1] seems to be a good option for various platforms, and it allows you 
>> to draw 3D text in 3D space..
>>
>> manu
>>
>> [1] http://homepages.paradise.net.nz/henryj/code/#FTGL
>>
>>
>> Donald Ephraim Curtis wrote:
>>     
>>> I have been informed on numerous occasions that using
>>> GLWidget::renderText is a bad idea.  However, in looking through the
>>> QT4.3 code it looks like this happens by doing a glUnproject on the 3d
>>> coordinates and then drawing the label using a QPainter.  Is this really
>>> so bad?  What ARE the downfalls of using renderText?
>>>
>>> In my own code under paintGL (and i know this may be the wrong spot) i
>>> tried doing a QPainter p(this) and then drawing my own text.  However
>>> when "i" attempt to do this i get a segfault.  
>>>
>>>       
>> >From the QT4 source it looks like in renderText they are doing some
>>     
>>> "magic" like disabling glClear() while painting etc.  They are also
>>> disabling AutoBufferSwap.  What I don't get is why when "i" create my
>>> own QPainter i get a segfault but when their code does it, they don't. 
>>>
>>> Also my question is the preferred way to render text.  Is it to paint on
>>> top of my widget with a painter?  I'd kinda like it to be rendered in
>>> the 3d environment so that as i zoom / rotate the size changes with the
>>> perspective.
>>>
>>> The other way that i attempted to do this was to using a QGLPixelBuffer
>>> and then doing an updateDynamicTexture but in this case it ends up
>>> showing the background from the pixelbuffer in the texture.  I'd need to
>>> have a way that makes the background transparent.  
>>>
>>> I'm having a hell of a time is the summary.  Any info is much
>>> appreciated.
>>>
>>> -Donald
>>>
>>> --
>>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
>>> "unsubscribe" in the subject or the body.
>>> List archive and information: http://lists.trolltech.com/qt-interest/
>>>       
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
>> "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>     
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>   

--
 [ signature omitted ] 

Message 5 in thread

'really simple' is always relative ;)
I would consider FTGL being the simplest and 'cross-platformest' way - but people have different 
opinions. hence, for a OpenGL font overview, have a look at the font survey [1].

manu

[1] http://www.opengl.org/resources/features/fontsurvey/


Donald Ephraim Curtis wrote:
> My only concern would be with having another dependancy.  I'm sure it's
> not very big etc.  Plus i'm also curious if there is a really simple way
> that i'm missing.
> 
> (Tue, Apr 03, 2007 at 10:30:03PM +0200) Manuela Hutter <manuela.hutter@xxxxxx>:
>> Have you thought of using an external lib?
>> FTGL [1] seems to be a good option for various platforms, and it allows you 
>> to draw 3D text in 3D space..
>>
>> manu
>>
>> [1] http://homepages.paradise.net.nz/henryj/code/#FTGL
>>
>>
>> Donald Ephraim Curtis wrote:
>>> I have been informed on numerous occasions that using
>>> GLWidget::renderText is a bad idea.  However, in looking through the
>>> QT4.3 code it looks like this happens by doing a glUnproject on the 3d
>>> coordinates and then drawing the label using a QPainter.  Is this really
>>> so bad?  What ARE the downfalls of using renderText?
>>>
>>> In my own code under paintGL (and i know this may be the wrong spot) i
>>> tried doing a QPainter p(this) and then drawing my own text.  However
>>> when "i" attempt to do this i get a segfault.  
>>>
>> >From the QT4 source it looks like in renderText they are doing some
>>> "magic" like disabling glClear() while painting etc.  They are also
>>> disabling AutoBufferSwap.  What I don't get is why when "i" create my
>>> own QPainter i get a segfault but when their code does it, they don't. 
>>>
>>> Also my question is the preferred way to render text.  Is it to paint on
>>> top of my widget with a painter?  I'd kinda like it to be rendered in
>>> the 3d environment so that as i zoom / rotate the size changes with the
>>> perspective.
>>>
>>> The other way that i attempted to do this was to using a QGLPixelBuffer
>>> and then doing an updateDynamicTexture but in this case it ends up
>>> showing the background from the pixelbuffer in the texture.  I'd need to
>>> have a way that makes the background transparent.  
>>>
>>> I'm having a hell of a time is the summary.  Any info is much
>>> appreciated.
>>>
>>> -Donald
>>>
>>> --
>>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
>>> "unsubscribe" in the subject or the body.
>>> List archive and information: http://lists.trolltech.com/qt-interest/
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
>> "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 6 in thread

You might consider rolling your own OpenGL font class that is taylored
for Qt. That's what I did and with it i can rotate text, scale it,
apply justification for specificed paragraph width, etc. You can also
try to optimize stuff a bit using GL extensions when available. My
code uses the standard blit textures techinque, aka I generate
textures for glphys on demand and then cache them for future use.

http://svn.sourceforge.net/viewvc/albumshaper/trunk/clay/src/_openGLTools/
http://svn.sourceforge.net/viewvc/albumshaper/trunk/clay/src/_openGLTools/openGLFont.h?view=markup

-Will

On 4/3/07, Manuela Hutter <manuela.hutter@xxxxxx> wrote:
> 'really simple' is always relative ;)
> I would consider FTGL being the simplest and 'cross-platformest' way - but people have different
> opinions. hence, for a OpenGL font overview, have a look at the font survey [1].
>
> manu
>
> [1] http://www.opengl.org/resources/features/fontsurvey/
>
>
> Donald Ephraim Curtis wrote:
> > My only concern would be with having another dependancy.  I'm sure it's
> > not very big etc.  Plus i'm also curious if there is a really simple way
> > that i'm missing.
> >
> > (Tue, Apr 03, 2007 at 10:30:03PM +0200) Manuela Hutter <manuela.hutter@xxxxxx>:
> >> Have you thought of using an external lib?
> >> FTGL [1] seems to be a good option for various platforms, and it allows you
> >> to draw 3D text in 3D space..
> >>
> >> manu
> >>
> >> [1] http://homepages.paradise.net.nz/henryj/code/#FTGL
> >>
> >>
> >> Donald Ephraim Curtis wrote:
> >>> I have been informed on numerous occasions that using
> >>> GLWidget::renderText is a bad idea.  However, in looking through the
> >>> QT4.3 code it looks like this happens by doing a glUnproject on the 3d
> >>> coordinates and then drawing the label using a QPainter.  Is this really
> >>> so bad?  What ARE the downfalls of using renderText?
> >>>
> >>> In my own code under paintGL (and i know this may be the wrong spot) i
> >>> tried doing a QPainter p(this) and then drawing my own text.  However
> >>> when "i" attempt to do this i get a segfault.
> >>>
> >> >From the QT4 source it looks like in renderText they are doing some
> >>> "magic" like disabling glClear() while painting etc.  They are also
> >>> disabling AutoBufferSwap.  What I don't get is why when "i" create my
> >>> own QPainter i get a segfault but when their code does it, they don't.
> >>>
> >>> Also my question is the preferred way to render text.  Is it to paint on
> >>> top of my widget with a painter?  I'd kinda like it to be rendered in
> >>> the 3d environment so that as i zoom / rotate the size changes with the
> >>> perspective.
> >>>
> >>> The other way that i attempted to do this was to using a QGLPixelBuffer
> >>> and then doing an updateDynamicTexture but in this case it ends up
> >>> showing the background from the pixelbuffer in the texture.  I'd need to
> >>> have a way that makes the background transparent.
> >>>
> >>> I'm having a hell of a time is the summary.  Any info is much
> >>> appreciated.
> >>>
> >>> -Donald
> >>>
> >>> --
> >>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> >>> "unsubscribe" in the subject or the body.
> >>> List archive and information: http://lists.trolltech.com/qt-interest/
> >> --
> >> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> >> "unsubscribe" in the subject or the body.
> >> List archive and information: http://lists.trolltech.com/qt-interest/
> >>
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ] 

Message 7 in thread

I have been experimenting with rendering text using a QPainter on a
QGLWidget in QT4.2.3.  At first i was getting segfaults, then i
commented out glEnableClientState( GL_NORMAL_ARRAY ); and it started
working.  Only problem is that anything rendered while GL_RESCALE_NORMAL
is glEnable()d doesn't render.  Is this a bug in QT4.2.3?

I'm including my entire initialization if this helps.

-Donald

  void GLWidget::initializeGL()
  {
    qDebug() << "GLWidget::initializeGL";
  
    qglClearColor ( d->background );
  
    glShadeModel( GL_SMOOTH );
    glEnable( GL_DEPTH_TEST );
    glDepthFunc( GL_LESS );
    glEnable( GL_CULL_FACE );
    glEnable( GL_COLOR_SUM_EXT );
  
    GLfloat mat_ambient[] = { 0.5, 0.5, 0.5, 1.0 };
    GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
    GLfloat mat_shininess[] = { 30.0 };
  
    glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
  
    // Used to display semi-transparent relection rectangle
    //  glBlendFunc(GL_ONE, GL_ONE);
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
  
    glEnable( GL_NORMALIZE );
    glEnable( GL_LIGHTING );
  
    GLfloat ambientLight[] = { 0.4, 0.4, 0.4, 1.0 };
    GLfloat diffuseLight[] = { 0.8, 0.8, 0.8, 1.0 };
    GLfloat specularLight[] = { 1.0, 1.0, 1.0, 1.0 };
    GLfloat position[] = { 0.8, 0.7, 1.0, 0.0 };
  
    glLightModeli( GL_LIGHT_MODEL_COLOR_CONTROL_EXT,
        GL_SEPARATE_SPECULAR_COLOR_EXT );
    glLightfv( GL_LIGHT0, GL_AMBIENT, ambientLight );
    glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuseLight );
    glLightfv( GL_LIGHT0, GL_SPECULAR, specularLight );
    glLightfv( GL_LIGHT0, GL_POSITION, position );
    glEnable( GL_LIGHT0 );
//   
//     glEnableClientState( GL_TEXTURE_COORD_ARRAY );
    glEnableClientState( GL_VERTEX_ARRAY );
    glEnableClientState( GL_NORMAL_ARRAY );
  }

--
 [ signature omitted ] 

Message 8 in thread

Hi,

Donald Ephraim Curtis wrote:
> I have been informed on numerous occasions that using
> GLWidget::renderText is a bad idea.  However, in looking through the
> QT4.3 code it looks like this happens by doing a glUnproject on the 3d
> coordinates and then drawing the label using a QPainter.  Is this really
> so bad?  What ARE the downfalls of using renderText?

QGLWidget::renderText() has been rewritten for 4.3, which is why it now 
uses a QPainter behind the scenes. The problem with renderText() prior 
to 4.3 was that it was implemented using the WGL/AGL/GLX extensions for 
drawing text in a GL context, which did not support any transformations, 
  drawing unicode text was not really supported, text anti-aliasing was 
only supported through a hack under X11 and so on.

In 4.3, we've changed the implementation to take advantage of the font 
rendering being done in the GL paint engine (it works by caching font 
glyphs in a GL texture, and is fairly fast), so it now supports unicode 
among other things. For compatibility reasons, the renderText() call do 
not take any transformations into consideration when the text is being 
drawn. However, you can open a QPainter on a QGLWidget and draw the text 
using plain QPainter::drawText() calls. When using a QPainter on a 
QGLWidget, there are several things you need to take into consideration:

1. QPainter::begin() changes the GL state of the current context, and 
assumes that state until QPainter::end() is called. There is no problem 
doing your own GL calls between QPainter::begin() and QPainter::end() if 
you take care to save/restore the GL state in between the calls.

2. QPainter::begin() will do a glClear() unless you disable the 
autoFillBackground property of a QGLWidget (it's on by default for 
QGLWidget). This means all drawing done prior to opening the QPainter 
will be cleared, unless you disable the autoFillBackground property.

3. QPainter::end() will do a buffer swap, unless you've disabled the 
auto buffer swap feature in QGLWidget. This means you might get a double 
buffer swap, one by QPainter::end() and one by QGLWidget::paintGL(), if 
you've chosen to open a QPainter inside a paintGL() reimplementation.

Keeping the above in mind, mixing GL calls and QPainter calls works like 
a charm, including drawing text. There should be a couple of examples on 
how to do this in the examples/opengl folder in the Qt distribution.

> In my own code under paintGL (and i know this may be the wrong spot) i
> tried doing a QPainter p(this) and then drawing my own text.  However
> when "i" attempt to do this i get a segfault.  

You should be able to open a QPainter both in paintGL() (keep the above 
note about clearing and double buffer swaps in mind) and in paintEvent() 
without problems.

> From the QT4 source it looks like in renderText they are doing some
> "magic" like disabling glClear() while painting etc.  They are also
> disabling AutoBufferSwap.  What I don't get is why when "i" create my
> own QPainter i get a segfault but when their code does it, they don't. 
> 
> Also my question is the preferred way to render text.  Is it to paint on
> top of my widget with a painter?  I'd kinda like it to be rendered in
> the 3d environment so that as i zoom / rotate the size changes with the
> perspective.

That's up to you really. If renderText() does the job for you, use it. 
Otherwise you can use a QPainter.

> The other way that i attempted to do this was to using a QGLPixelBuffer
> and then doing an updateDynamicTexture but in this case it ends up
> showing the background from the pixelbuffer in the texture.  I'd need to
> have a way that makes the background transparent.  
> 
> I'm having a hell of a time is the summary.  Any info is much
> appreciated.
> 
> -Donald

Regards,
--
 [ signature omitted ] 

Message 9 in thread

I've succesfully implemented some of your needs here, DOnald,  by using a
QPainter in a QGLWidget, as proposed by Trond.

Trond Kjernaasen wrote: 
> When using a QPainter on a
> QGLWidget, there are several things you need to take into consideration:
(...)

You may also like having a look on the overpainting example provided in
Qt422. It shows you a path for using both opengl calls and QPainter (as
proposed by Tron... but having an example is better to start).

Best-
Nicolas


Trond Kjernaasen wrote: 

> Hi,
> 
> Donald Ephraim Curtis wrote:
>> I have been informed on numerous occasions that using
>> GLWidget::renderText is a bad idea.  However, in looking through the
>> QT4.3 code it looks like this happens by doing a glUnproject on the 3d
>> coordinates and then drawing the label using a QPainter.  Is this really
>> so bad?  What ARE the downfalls of using renderText?
> 
> QGLWidget::renderText() has been rewritten for 4.3, which is why it now
> uses a QPainter behind the scenes. The problem with renderText() prior
> to 4.3 was that it was implemented using the WGL/AGL/GLX extensions for
> drawing text in a GL context, which did not support any transformations,
>   drawing unicode text was not really supported, text anti-aliasing was
> only supported through a hack under X11 and so on.
> 
> In 4.3, we've changed the implementation to take advantage of the font
> rendering being done in the GL paint engine (it works by caching font
> glyphs in a GL texture, and is fairly fast), so it now supports unicode
> among other things. For compatibility reasons, the renderText() call do
> not take any transformations into consideration when the text is being
> drawn. However, you can open a QPainter on a QGLWidget and draw the text
> using plain QPainter::drawText() calls. When using a QPainter on a
> QGLWidget, there are several things you need to take into consideration:
> 
> 1. QPainter::begin() changes the GL state of the current context, and
> assumes that state until QPainter::end() is called. There is no problem
> doing your own GL calls between QPainter::begin() and QPainter::end() if
> you take care to save/restore the GL state in between the calls.
> 
> 2. QPainter::begin() will do a glClear() unless you disable the
> autoFillBackground property of a QGLWidget (it's on by default for
> QGLWidget). This means all drawing done prior to opening the QPainter
> will be cleared, unless you disable the autoFillBackground property.
> 
> 3. QPainter::end() will do a buffer swap, unless you've disabled the
> auto buffer swap feature in QGLWidget. This means you might get a double
> buffer swap, one by QPainter::end() and one by QGLWidget::paintGL(), if
> you've chosen to open a QPainter inside a paintGL() reimplementation.
> 
> Keeping the above in mind, mixing GL calls and QPainter calls works like
> a charm, including drawing text. There should be a couple of examples on
> how to do this in the examples/opengl folder in the Qt distribution.
> 
>> In my own code under paintGL (and i know this may be the wrong spot) i
>> tried doing a QPainter p(this) and then drawing my own text.  However
>> when "i" attempt to do this i get a segfault.
> 
> You should be able to open a QPainter both in paintGL() (keep the above
> note about clearing and double buffer swaps in mind) and in paintEvent()
> without problems.
> 
>> From the QT4 source it looks like in renderText they are doing some
>> "magic" like disabling glClear() while painting etc.  They are also
>> disabling AutoBufferSwap.  What I don't get is why when "i" create my
>> own QPainter i get a segfault but when their code does it, they don't.
>> 
>> Also my question is the preferred way to render text.  Is it to paint on
>> top of my widget with a painter?  I'd kinda like it to be rendered in
>> the 3d environment so that as i zoom / rotate the size changes with the
>> perspective.
> 
> That's up to you really. If renderText() does the job for you, use it.
> Otherwise you can use a QPainter.
> 
>> The other way that i attempted to do this was to using a QGLPixelBuffer
>> and then doing an updateDynamicTexture but in this case it ends up
>> showing the background from the pixelbuffer in the texture.  I'd need to
>> have a way that makes the background transparent.
>> 
>> I'm having a hell of a time is the summary.  Any info is much
>> appreciated.
>> 
>> -Donald
> 
> Regards,
> --
> Trond K.

--
 [ signature omitted ]