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