Commit 3501a9e3 authored by Frédéric Larue's avatar Frédéric Larue

renderShadowedText() functions added to GLViewer.

parent fd7bfa83
......@@ -1528,6 +1528,22 @@ void GLViewer::renderText( float x, float y, const QString &text, const QFont &f
}
void GLViewer::renderShadowedText( float x, float y, const QString &text, const QFont &font, Qt::Alignment align )
{
GLfloat color[4];
glGetFloatv( GL_CURRENT_COLOR, color );
QColor shadow = QApplication::palette().color( QPalette::Dark );
glColor4ub( shadow.red(), shadow.green(), shadow.blue(), 80 );
renderText( x-1, y-1, text, font, align );
renderText( x+1, y+1, text, font, align );
renderText( x+2, y+1, text, font, align );
glColor4fv( color );
renderText( x, y, text, font, align );
}
bool GLViewer::imageOfCurrentDisplay( const GenericUIData *m, QImage &renderResult )
{
// Check if the provided item is currently displayed.
......
......@@ -390,10 +390,14 @@ public:
QVector2D screenCoords( float x, float y, float z ) const;
inline QVector2D screenCoords( const QVector3D &v ) const { return screenCoords(v.x(),v.y(),v.z()); }
inline void renderText( const QVector2D &v, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderText(v.x(),v.y(),text,font,align); }
inline void renderText( const QVector3D &v, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderText(screenCoords(v),text,font,align); }
inline void renderText( float x, float y, float z, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderText(screenCoords(x,y,z),text,font,align); }
inline void renderText( const QVector2D &v, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderText(v.x(),v.y(),text,font,align); }
inline void renderText( const QVector3D &v, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderText(screenCoords(v),text,font,align); }
inline void renderText( float x, float y, float z, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderText(screenCoords(x,y,z),text,font,align); }
void renderText( float x, float y, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 );
inline void renderShadowedText( const QVector2D &v, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderShadowedText(v.x(),v.y(),text,font,align); }
inline void renderShadowedText( const QVector3D &v, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderShadowedText(screenCoords(v),text,font,align); }
inline void renderShadowedText( float x, float y, float z, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 ) { renderShadowedText(screenCoords(x,y,z),text,font,align); }
void renderShadowedText( float x, float y, const QString &text, const QFont &font = QFont(), Qt::Alignment align = 0 );
bool imageOfCurrentDisplay( const GenericUIData *m, QImage &renderResult );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment