From 5800130faecedbf7554f463d0e0c271ca25c1a71 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 9 Apr 2009 23:10:28 +0000 Subject: [PATCH] - graphics API: add rotation arg to txf_render_string() (from Carl C.) svn path=/trunk/boinc/; revision=17774 --- api/txf_util.cpp | 9 ++++++--- api/txf_util.h | 3 ++- checkin_notes | 7 +++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/api/txf_util.cpp b/api/txf_util.cpp index e7b5e6a3e0..c6591b8e2a 100644 --- a/api/txf_util.cpp +++ b/api/txf_util.cpp @@ -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: diff --git a/api/txf_util.h b/api/txf_util.h index 4e3c3f3e0e..444d38f217 100644 --- a/api/txf_util.h +++ b/api/txf_util.h @@ -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 diff --git a/checkin_notes b/checkin_notes index 616715c99c..60142fc8ed 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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