drawText method

Hi all,

I would like to know if the use of :
int GLPainter::drawText ( const Eigen::Vector3d &pos, const QString &string
)
is “equals to” (performance, issuie known …) (with the fonts support) :
int GLPainter::drawText(const Eigen::Vector3d &pos, const QString &string,
const QFont &font)
?

I’m curious because I’ve never seen used of the 2nd method (and it works
differently). It might be interesting to change style depending on the
features (autooptool, clickmeasuretool …). And I wanted to use it
toincreasethe size of the
default font. Do you think this is the correct method for this ?

Regards,
Mickaël Gadroy

Hi,

On Fri, Mar 18, 2011 at 11:34 AM, Mickaël Gadroy
mickael.gadroy@gmail.com wrote:

Hi all,

I would like to know if the use of :
int GLPainter::drawText ( const Eigen::Vector3d &pos, const QString &string
)
is “equals to” (performance, issuie known …) (with the fonts support) :
int GLPainter::drawText(const Eigen::Vector3d &pos, const QString &string,
const QFont &font)
?

I’m curious because I’ve never seen used of the 2nd method (and it works
differently). It might be interesting to change style depending on the
features (autooptool, clickmeasuretool …). And I wanted to use it to
increase the size of the default font. Do you think this is the correct
method for this ?

The second signature is new, changing the fonts, size etc is likely to
perform worse as more glyphs will need to be generated. Changing color
should not hit this, but font face, size, style etc would.

Marcus

Hi,

I have tested :
int GLPainter::drawText(const Eigen::Vector3d &pos, const QString &string,
const QFont &font)
And I have problems :

  • The text isn’t drawn ;
  • The 2nd text (using drawText(QPoint, QString)) isn’t drawn correctly ;
  • the atoms are displayed as if there is no z-buffer …
  • the begin() and end() methods are not available (not present in the
    Painter virtual class)

============================================
Code :
In a paint() method : class WmTool : public Tool

QString msg=“A message” ;
glColor3f( 1.0, 1.0, 1.0 ) ;

// 1st test with :
// →
m_wPainter->drawText( QPoint(10,20), msg ) ; // Work fine.
// ←

// 2nd test with :
// →
QFont myFont( “Times”, 32, QFont::Bold ) ;
m_wPainter->drawText( Vector3d(10,40,25), msg, myFont ) ; // No display
m_wPainter->drawText( QPoint(10,20), msg ) ; // Work but the display is
different (bold,
// and I don’t recognize the family font).
// ←

// 3rd test with :
// →
// #include “glpainter_p.h” : inaccessible
GLPainter wGLPainter=dynamic_cast<GLPainter>(m_wPainter) ; // Not compile

QFont myFont( “Times”, 32, QFont::Bold ) ;
wGLPainter->begin() ; // inaccessible (not present the Painter class)
wGLPainter->drawText( Vector3d(10,40,25), msg, myFont ) ; // not compile
wGLPainter->end() ; // inaccessible (not present the Painter class)
// ←

============================================

Help,
Regards,
Mickael Gadroy

2011/3/18 Marcus D. Hanwell mhanwell@gmail.com

Hi,

On Fri, Mar 18, 2011 at 11:34 AM, Mickaël Gadroy
mickael.gadroy@gmail.com wrote:

Hi all,

I would like to know if the use of :
int GLPainter::drawText ( const Eigen::Vector3d &pos, const QString
&string
)
is “equals to” (performance, issuie known …) (with the fonts support)
:
int GLPainter::drawText(const Eigen::Vector3d &pos, const QString
&string,
const QFont &font)
?

I’m curious because I’ve never seen used of the 2nd method (and it
works
differently). It might be interesting to change style depending on the
features (autooptool, clickmeasuretool …). And I wanted to use it to
increase the size of the default font. Do you think this is the correct
method for this ?

The second signature is new, changing the fonts, size etc is likely to
perform worse as more glyphs will need to be generated. Changing color
should not hit this, but font face, size, style etc would.

Marcus