used QPainter to render the axis labels

This commit is contained in:
granzuglia 2010-10-04 08:46:19 +00:00
parent 497c82bdac
commit 7df0c698d6
2 changed files with 23 additions and 8 deletions

View File

@ -48,6 +48,7 @@ first version
#include <wrap/gl/math.h>
#include <wrap/gl/space.h>
#include <wrap/gl/addons.h>
#include <wrap/qt/gl_label.h>
#include "coordinateframe.h"
@ -61,7 +62,7 @@ CoordinateFrame::CoordinateFrame(float s)
font.setFamily("Helvetica");
}
void CoordinateFrame::Render(QGLWidget* glw)
void CoordinateFrame::Render(QGLWidget* glw,QPainter* p)
{
assert( glw!= NULL);
glPushAttrib(GL_ALL_ATTRIB_BITS);
@ -128,12 +129,26 @@ void CoordinateFrame::Render(QGLWidget* glw)
font.setBold(true);
font.setPixelSize(12);
float d=size+scalefactor*linewidth*1.5;
glColor(xcolor);
glw->renderText(d,0,0,QString("X"),font);
glColor(ycolor);
glw->renderText(0,d,0,QString("Y"),font);
glColor(zcolor);
glw->renderText(0,0,d,QString("Z"),font);
if (p)
vcg::glLabel::render(p,vcg::Point3f(d,0,0),QString("X"),font,xcolor);
{
glColor(xcolor);
glw->renderText(d,0,0,QString("X"),font);
}
if (p)
vcg::glLabel::render(p,vcg::Point3f(0,d,0),QString("Y"),font,ycolor);
{
glColor(ycolor);
glw->renderText(0,d,0,QString("Y"),font);
}
if (p)
vcg::glLabel::render(p,vcg::Point3f(0,0,d),QString("Z"),font,zcolor);
{
glColor(zcolor);
glw->renderText(0,0,d,QString("Z"),font);
}
}
if(drawvalues){
font.setBold(false);

View File

@ -80,7 +80,7 @@ public:
@param glw the GL widget.
*/
virtual void Render(QGLWidget* glw);
virtual void Render(QGLWidget* glw,QPainter* p = NULL);
// data
/// The color used for the ticks, the ticks values and the head of the arrows.