- graphics API: full-on 3D rotation of text

svn path=/trunk/boinc/; revision=17777
This commit is contained in:
David Anderson 2009-04-10 05:34:24 +00:00
parent 930d3c08a3
commit e628dba3ed
2 changed files with 12 additions and 4 deletions

View File

@ -54,6 +54,7 @@ void txf_load_fonts(char* dir) {
}
}
void txf_render_string(
float alpha_value,
// reference value to which incoming alpha values are compared.
@ -63,7 +64,10 @@ void txf_render_string(
GLfloat * col, // colour
int i, // font index see texfont.h
char * s, // string ptr
float fRotation // optional rotation angle in degrees
float fRotAngle, // optional rotation angle
float fRotX, // optional rotation vector for X
float fRotY, // optional rotation vector for Y
float fRotZ // optional rotation vector for Z
){
glPushMatrix();
glEnable(GL_TEXTURE_2D);
@ -72,8 +76,8 @@ void txf_render_string(
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);
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);
// use .1 and .5 for a dark and bright background respectively
@ -87,6 +91,7 @@ void txf_render_string(
glPopMatrix();
}
#if 0
int main (){
// usage:

View File

@ -35,7 +35,10 @@ extern void txf_render_string(
GLfloat * col, // colour
int i, // font index see texfont.h
char * s, // string ptr
float fRotation = 0.0f // optional rotation angle
float fRotAngle = 0.0f, // optional rotation angle
float fRotX = 0.0f, // optional rotation vector for X
float fRotY = 0.0f, // optional rotation vector for Y
float fRotZ = 1.0f // optional rotation vector for Z
);
#ifdef __cplusplus