Hi CornedBee,
Thanks for the reply. I have a bitmap image with 70 characters of a particular font mapped out on it. I have stored the exact coordinates of these 70 characters in a STL vector So I have a global 'vector <FONT> font'. There exists a font[z].ascii that holds the ascii number (int) of the corresponding font.
I want to read one character at a time from a string 'text' and look in the font[].ascii for a match.
I added your code in mine below. I substituted the 'm' for your 'i'. Also, I got errors manipulating 'text' directly so I had to place the value into another string 'onestr'. No more errors. However, I do not think this code is working correctly....
Any more tips would be helpful.
Regards,
ChuckB
Code:void DrawText2D(int x, int y, int size, const string& text ){ string onestr=text; glEnable(GL_TEXTURE_2D); glBindTexture ( GL_TEXTURE_2D, texture_objects[TEX_FONT1]); glBegin(GL_QUADS); for(string::iterator m = onestr.begin(); m != onestr.end(); ++m) { for (int z=1;z < 70; z++){ //scroll through font vector looking for match if( *m == font[z].ascii){ glTexCoord2f(font[z].a.x, font[z].a.y); glVertex2f(x + step * size, y ); . . . etc.




Reply With Quote