Skip to content
Snippets Groups Projects
Commit 9cdf843b authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fine-tuning fonts and scale

parent 8d3c62cb
Branches
Tags
No related merge requests found
...@@ -66,7 +66,7 @@ drawContext::drawContext(bool isRetina) ...@@ -66,7 +66,7 @@ drawContext::drawContext(bool isRetina)
_fillMesh = false; _fillMesh = false;
_gradiant = true; _gradiant = true;
_fontFactor = isRetina ? 2 : 1; _fontFactor = isRetina ? 1.5 : 1;
} }
static void checkGlError(const char* op) static void checkGlError(const char* op)
...@@ -555,15 +555,15 @@ void drawContext::drawScale() ...@@ -555,15 +555,15 @@ void drawContext::drawScale()
sprintf(label, "%s", data->getName().c_str()); sprintf(label, "%s", data->getName().c_str());
} }
drawString lbl(label, 20 * _fontFactor); drawString lbl(label, 20 * _fontFactor);
lbl.draw(xmin+width/2, ymin+ 2.5*dh, 0., lbl.draw(xmin + width / 2, ymin + 2.75 * dh, 0.,
_width/(_right-_left), _height/(_top-_bottom)); _width/(_right-_left), _height/(_top-_bottom));
drawString val(data->getName().c_str(), 14*_fontFactor); drawString val(data->getName().c_str(), 15 * _fontFactor);
for(int i = 0; i < 3; i++) { for(int i = 0; i < 3; i++) {
double v = opt->getScaleValue(i, 3, opt->tmpMin, opt->tmpMax); double v = opt->getScaleValue(i, 3, opt->tmpMin, opt->tmpMax);
sprintf(label, opt->format.c_str(), v); sprintf(label, opt->format.c_str(), v);
val.setText(label); val.setText(label);
val.draw(xmin+i*width/2, ymin+ 1.1*dh, 0., val.draw(xmin + i * width/ 2, ymin + 1.5 * dh, 0.,
_width/(_right-_left), _height/(_top-_bottom)); _width/(_right-_left), _height/(_top-_bottom));
} }
nPview++; nPview++;
...@@ -614,12 +614,12 @@ void drawContext::drawAxes(float x0, float y0, float z0, float h) ...@@ -614,12 +614,12 @@ void drawContext::drawAxes(float x0, float y0, float z0, float h)
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_COLOR_ARRAY);
double dx = h / 10; double dx = h / 10;
drawString x ("X", 14*_fontFactor,colors); drawString x("X", 15 * _fontFactor, colors);
x.draw(x0+h+dx, y0, z0, _width/(_right-_left), _height/(_top-_bottom), false); x.draw(x0+h+dx, y0+dx, z0+dx, _width/(_right-_left), _height/(_top-_bottom), false);
drawString y("Y", 14*_fontFactor,colors+8); drawString y("Y", 15 * _fontFactor, colors+8);
y.draw(x0+dx, y0+h, z0, _width/(_right-_left), _height/(_top-_bottom), false); y.draw(x0+dx, y0+h+dx, z0+dx, _width/(_right-_left), _height/(_top-_bottom), false);
drawString z("Z", 14*_fontFactor,colors+16); drawString z("Z", 15 * _fontFactor, colors+16);
z.draw(x0+dx, y0, z0+h, _width/(_right-_left), _height/(_top-_bottom), false); z.draw(x0+dx, y0+dx, z0+h+dx, _width/(_right-_left), _height/(_top-_bottom), false);
glPopMatrix(); glPopMatrix();
glLineWidth(1); glLineWidth(1);
} }
...@@ -629,7 +629,6 @@ void drawContext::drawView() ...@@ -629,7 +629,6 @@ void drawContext::drawView()
OrthofFromGModel(); OrthofFromGModel();
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
// fill the background // fill the background
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(_gradiant){ if(_gradiant){
...@@ -661,6 +660,7 @@ void drawContext::drawView() ...@@ -661,6 +660,7 @@ void drawContext::drawView()
glLoadIdentity(); glLoadIdentity();
glScalef(_scale[0], _scale[1], _scale[2]); glScalef(_scale[0], _scale[1], _scale[2]);
glTranslatef(_translate[0], _translate[1], _translate[2]); glTranslatef(_translate[0], _translate[1], _translate[2]);
if(CTX::instance()->rotationCenterCg) if(CTX::instance()->rotationCenterCg)
glTranslatef(CTX::instance()->cg[0], glTranslatef(CTX::instance()->cg[0],
CTX::instance()->cg[1], CTX::instance()->cg[1],
...@@ -669,8 +669,10 @@ void drawContext::drawView() ...@@ -669,8 +669,10 @@ void drawContext::drawView()
glTranslatef(CTX::instance()->rotationCenter[0], glTranslatef(CTX::instance()->rotationCenter[0],
CTX::instance()->rotationCenter[1], CTX::instance()->rotationCenter[1],
CTX::instance()->rotationCenter[2]); CTX::instance()->rotationCenter[2]);
buildRotationMatrix(); buildRotationMatrix();
glMultMatrixf(_rotatef); glMultMatrixf(_rotatef);
if(CTX::instance()->rotationCenterCg) if(CTX::instance()->rotationCenterCg)
glTranslatef(-CTX::instance()->cg[0], glTranslatef(-CTX::instance()->cg[0],
-CTX::instance()->cg[1], -CTX::instance()->cg[1],
...@@ -679,15 +681,14 @@ void drawContext::drawView() ...@@ -679,15 +681,14 @@ void drawContext::drawView()
glTranslatef(-CTX::instance()->rotationCenter[0], glTranslatef(-CTX::instance()->rotationCenter[0],
-CTX::instance()->rotationCenter[1], -CTX::instance()->rotationCenter[1],
-CTX::instance()->rotationCenter[2]); -CTX::instance()->rotationCenter[2]);
checkGlError("Initialize position"); checkGlError("Initialize position");
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
drawMesh(); drawMesh();
checkGlError("Draw mesh"); checkGlError("Draw mesh");
drawGeom(); drawGeom();
checkGlError("Draw geometry"); checkGlError("Draw geometry");
drawPost(); drawPost();
checkGlError("Draw post-pro"); checkGlError("Draw post-pro");
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment