used QPainter to render the axis labels
This commit is contained in:
parent
497c82bdac
commit
7df0c698d6
|
@ -48,6 +48,7 @@ first version
|
||||||
#include <wrap/gl/math.h>
|
#include <wrap/gl/math.h>
|
||||||
#include <wrap/gl/space.h>
|
#include <wrap/gl/space.h>
|
||||||
#include <wrap/gl/addons.h>
|
#include <wrap/gl/addons.h>
|
||||||
|
#include <wrap/qt/gl_label.h>
|
||||||
|
|
||||||
#include "coordinateframe.h"
|
#include "coordinateframe.h"
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ CoordinateFrame::CoordinateFrame(float s)
|
||||||
font.setFamily("Helvetica");
|
font.setFamily("Helvetica");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoordinateFrame::Render(QGLWidget* glw)
|
void CoordinateFrame::Render(QGLWidget* glw,QPainter* p)
|
||||||
{
|
{
|
||||||
assert( glw!= NULL);
|
assert( glw!= NULL);
|
||||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||||
|
@ -128,12 +129,26 @@ void CoordinateFrame::Render(QGLWidget* glw)
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
font.setPixelSize(12);
|
font.setPixelSize(12);
|
||||||
float d=size+scalefactor*linewidth*1.5;
|
float d=size+scalefactor*linewidth*1.5;
|
||||||
glColor(xcolor);
|
if (p)
|
||||||
glw->renderText(d,0,0,QString("X"),font);
|
vcg::glLabel::render(p,vcg::Point3f(d,0,0),QString("X"),font,xcolor);
|
||||||
glColor(ycolor);
|
{
|
||||||
glw->renderText(0,d,0,QString("Y"),font);
|
glColor(xcolor);
|
||||||
glColor(zcolor);
|
glw->renderText(d,0,0,QString("X"),font);
|
||||||
glw->renderText(0,0,d,QString("Z"),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){
|
if(drawvalues){
|
||||||
font.setBold(false);
|
font.setBold(false);
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
|
|
||||||
@param glw the GL widget.
|
@param glw the GL widget.
|
||||||
*/
|
*/
|
||||||
virtual void Render(QGLWidget* glw);
|
virtual void Render(QGLWidget* glw,QPainter* p = NULL);
|
||||||
// data
|
// data
|
||||||
|
|
||||||
/// The color used for the ticks, the ticks values and the head of the arrows.
|
/// The color used for the ticks, the ticks values and the head of the arrows.
|
||||||
|
|
Loading…
Reference in New Issue