- graphics API: add rotation arg to txf_render_string()

(from Carl C.)

svn path=/trunk/boinc/; revision=17774
This commit is contained in:
David Anderson 2009-04-09 23:10:28 +00:00
parent 1a8e70d5f6
commit 5800130fae
3 changed files with 15 additions and 4 deletions

View File

@ -54,7 +54,6 @@ void txf_load_fonts(char* dir) {
}
}
void txf_render_string(
float alpha_value,
// reference value to which incoming alpha values are compared.
@ -63,7 +62,8 @@ void txf_render_string(
float fscale, // scale factor
GLfloat * col, // colour
int i, // font index see texfont.h
char * s // string ptr
char * s, // string ptr
float fRotation // optional rotation angle in degrees
){
glPushMatrix();
glEnable(GL_TEXTURE_2D);
@ -71,6 +71,10 @@ void txf_render_string(
glBindTexture(GL_TEXTURE_2D, txf[i]->texobj);
glTranslated(x, y, z);
glScalef(1/fscale, 1/fscale, 1/fscale);
if (fRotation != 0.0f) { // we want to rotate around Z, which keeps our text in 2D plane
glRotatef(fRotation, 0.0f, 0.0f, 1.0f);
}
glEnable(GL_ALPHA_TEST);
// use .1 and .5 for a dark and bright background respectively
glAlphaFunc(GL_GEQUAL, alpha_value);
@ -83,7 +87,6 @@ void txf_render_string(
glPopMatrix();
}
#if 0
int main (){
// usage:

View File

@ -34,7 +34,8 @@ extern void txf_render_string(
float fscale, // scale factor
GLfloat * col, // colour
int i, // font index see texfont.h
char * s // string ptr
char * s, // string ptr
float fRotation = 0.0f // optional rotation angle
);
#ifdef __cplusplus

View File

@ -3749,3 +3749,10 @@ Rom 9 Apr 2009
win_build/installerv2/redist/Windows/x64/
boinccas.dll
boinccas95.dll
David 9 Apr 2009
- graphics API: add rotation arg to txf_render_string()
(from Carl C.)
api/
txf_util.cpp,h