Font rendering functional: test string

This commit is contained in:
Charles J. Cliffe
2014-12-08 19:38:38 -05:00
parent 6c7372ed90
commit 542326baab
3 changed files with 64 additions and 7 deletions
+10 -1
View File
@@ -33,7 +33,16 @@ void SpectrumContext::Draw(std::vector<float> &points) {
glPopMatrix();
}
getFont()->drawString("Testing",0.0,0.0,0.7);
GLint vp[4];
glGetIntegerv( GL_VIEWPORT, vp);
std::string msgStr("Welcome to CubicSDR -- This is a test string. 01234567890!@#$%^&*()_[]");
float charHeight = 62.0;
float viewAspect = (float)vp[2]/(float)vp[3];
float msgWidth = getFont()->getStringWidth(msgStr,charHeight/(float)vp[3],viewAspect);
getFont()->drawString(msgStr,0.0-(msgWidth/2.0),0.0,charHeight/(float)vp[3],viewAspect);
CheckGLError();
}