63
64
float fscale, // scale factor
64
65
GLfloat * col, // colour
65
66
int i, // font index see texfont.h
66
char * s // string ptr
67
char * s, // string ptr
68
float fRotAngle, // optional rotation angle
69
float fRotX, // optional rotation vector for X
70
float fRotY, // optional rotation vector for Y
71
float fRotZ // optional rotation vector for Z
73
// if requested font isn't available, find first one that is
75
while((i < TXF_NUM_FONT) && !txf[i]) i++;
76
if((i >= TXF_NUM_FONT) || !txf[i]) {
69
81
glEnable(GL_TEXTURE_2D);
70
if((i < TXF_NUM_FONT) && txf[i]) {
71
glBindTexture(GL_TEXTURE_2D, txf[i]->texobj);
72
glTranslated(x, y, z);
73
glScalef(1/fscale, 1/fscale, 1/fscale);
74
glEnable(GL_ALPHA_TEST);
75
// use .1 and .5 for a dark and bright background respectively
76
glAlphaFunc(GL_GEQUAL, alpha_value);
77
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
78
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
80
txfRenderString(txf[i], s, (int)strlen(s));
82
glBindTexture(GL_TEXTURE_2D, txf[i]->texobj);
83
glTranslated(x, y, z);
84
glScalef(1/fscale, 1/fscale, 1/fscale);
85
if (fRotAngle != 0.0f) {
86
// we want to rotate around Z y default,
87
// which keeps our text in 2D plane
88
glRotatef(fRotAngle, fRotX, fRotY, fRotZ);
90
glEnable(GL_ALPHA_TEST);
91
// use .1 and .5 for a dark and bright background respectively
92
glAlphaFunc(GL_GEQUAL, alpha_value);
93
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
94
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
96
txfRenderString(txf[i], s, (int)strlen(s));
82
97
glDisable(GL_TEXTURE_2D);