Updated to the new glLabel calling style

This commit is contained in:
Paolo Cignoni 2010-10-31 13:07:17 +00:00
parent 3f48658c57
commit 30186419dc
1 changed files with 18 additions and 32 deletions

View File

@ -74,7 +74,7 @@ void CoordinateFrame::Render(QGLWidget* glw,QPainter* p)
glEnable(GL_POINT_SMOOTH);
glLineWidth(linewidth);
glPointSize(linewidth*1.5);
glLabel::Mode md;
Point3d o(0,0,0);
Point3d a(size,0,0);
Point3d b(0,size,0);
@ -126,46 +126,32 @@ void CoordinateFrame::Render(QGLWidget* glw,QPainter* p)
glPopMatrix();
}
if(drawlabels){
font.setBold(true);
font.setPixelSize(12);
md.qFont.setBold(true);
md.qFont.setPixelSize(12);
float d=size+scalefactor*linewidth*1.5;
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 (p) {
vcg::glLabel::render(p,vcg::Point3f(d,0,0),QString("X"),md);
vcg::glLabel::render(p,vcg::Point3f(0,d,0),QString("Y"),md);
vcg::glLabel::render(p,vcg::Point3f(0,0,d),QString("Z"),md);
}
}
if(drawvalues){
font.setBold(false);
font.setPixelSize(8);
md.qFont.setBold(false);
md.qFont.setPixelSize(8);
md.color=Color4b(Color4b::LightGray);
float i;
glColor(Color4b::LightGray);
for(i=slope_a;i<size;i+=slope_a){
glw->renderText( i,0,0,QString(" %1").arg(i,3,'f',1),font);
glw->renderText(-i,0,0,QString("-%1").arg(i,3,'f',1),font);
vcg::glLabel::render(p,vcg::Point3f( i,0,0),QString(" %1").arg(i,3,'f',1),md);
vcg::glLabel::render(p,vcg::Point3f(-i,0,0),QString(" %1").arg(i,3,'f',1),md);
}
for(i=slope_b;i<size;i+=slope_b){
glw->renderText(0, i,0,QString(" %1").arg(i,3,'f',1),font);
glw->renderText(0,-i,0,QString("-%1").arg(i,3,'f',1),font);
vcg::glLabel::render(p,vcg::Point3f(0, i,0),QString(" %1").arg(i,3,'f',1),md);
vcg::glLabel::render(p,vcg::Point3f(0,-i,0),QString(" %1").arg(i,3,'f',1),md);
}
for(i=slope_c;i<size;i+=slope_c){
glw->renderText(0,0, i,QString(" %1").arg(i,3,'f',1),font);
glw->renderText(0,0,-i,QString("-%1").arg(i,3,'f',1),font);
vcg::glLabel::render(p,vcg::Point3f(0,0, i),QString(" %1").arg(i,3,'f',1),md);
vcg::glLabel::render(p,vcg::Point3f(0,0,-i),QString(" %1").arg(i,3,'f',1),md);
}
}
glGetError(); // Patch to buggy qt rendertext;