- graphics API: if font missing, find one that isn't (from Kevin)

svn path=/trunk/boinc/; revision=20350
This commit is contained in:
David Anderson 2010-02-01 19:18:23 +00:00
parent bced79447d
commit 7d229ccf4b
2 changed files with 28 additions and 16 deletions

View File

@ -69,14 +69,21 @@ void txf_render_string(
float fRotY, // optional rotation vector for Y
float fRotZ // optional rotation vector for Z
){
// if requested font isn't available, find first one that is
//
while((i < TXF_NUM_FONT) && !txf[i]) i++;
if((i >= TXF_NUM_FONT) || !txf[i]) {
// bad font index
return;
}
glPushMatrix();
glEnable(GL_TEXTURE_2D);
if((i < TXF_NUM_FONT) && txf[i]) {
glBindTexture(GL_TEXTURE_2D, txf[i]->texobj);
glTranslated(x, y, z);
glScalef(1/fscale, 1/fscale, 1/fscale);
if (fRotAngle != 0.0f) { // we want to rotate around Z y default, which keeps our text in 2D plane
if (fRotAngle != 0.0f) {
// we want to rotate around Z y default,
// which keeps our text in 2D plane
glRotatef(fRotAngle, fRotX, fRotY, fRotZ);
}
glEnable(GL_ALPHA_TEST);
@ -86,7 +93,6 @@ void txf_render_string(
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glColor4fv(col);
txfRenderString(txf[i], s, (int)strlen(s));
}
glDisable(GL_TEXTURE_2D);
glPopMatrix();
}

View File

@ -815,3 +815,9 @@ David 30 Jan 2010
clientgui/
AdvancedFrame.cpp
David 1 Feb 2010
- graphics API: if font missing, find one that isn't (from Kevin)
api/
txf_util.cpp