PDA

View Full Version : Problem using text



alex_r
09-08-2002, 08:41 PM
I'm readint the NeHe tutorial number 17 (2D Texture Font), the problem is, how I draw texts using chars like "", "" and others???
I have the picture with ASCII char, but the changes didn't work, he didn't draw the char...

Thx

[This message has been edited by alex_r (edited 09-08-2002).]

nexusone
09-09-2002, 04:42 PM
Because the Nehe demo uses a bit map with only the English set of charactors.
Once you learn how he put's the charactors on the screen, it will be easy for you to add other's that are used in other languages.


Originally posted by alex_r:
I'm readint the NeHe tutorial number 17 (2D Texture Font), the problem is, how I draw texts using chars like "", "" and others???
I have the picture with ASCII char, but the changes didn't work, he didn't draw the char...

Thx

[This message has been edited by alex_r (edited 09-08-2002).]



[This message has been edited by nexusone (edited 09-09-2002).]

alex_r
09-09-2002, 05:31 PM
I know how, I changed the number of chars, but he ignore these chars... Anyone know were is the problem or know any sample???

Thx again
Alexandre Ribeiro de S

nexusone
09-10-2002, 05:00 AM
I don't think you understand the nehe tutor.
There is no problem with his code, it does what he intended it to do. Take letters drawn on a bitmap and use them to create textured based text.

He draws the charactors to a bitmap image file with all of the letters he wants to use.
Since he is using only English, he only includes numbers and letters needed.

Just create a image file in a paint program with all the charactors you want use.
Then adjust his code to use your charactors set.



Originally posted by alex_r:
I know how, I changed the number of chars, but he ignore these chars... Anyone know were is the problem or know any sample???

Thx again
Alexandre Ribeiro de S

alex_r
09-10-2002, 10:00 AM
No, Nehe use a bimap with two fonts, in this bitmap, I can't use these letters, them I try to use one font in bitmap.
It's not just change the picture...

nexusone
09-10-2002, 11:29 AM
If you had read his tutor/code, ASCII charactors start at 32, 32 = " " being a space. Anything before 32 is control charactors.

On his bitmap the space is the first charactor.

You will have to manualy convert the ASCII charactor number to one the translates to the position on the BMP file.
If you count the charactors on the bitmap, you find your charactors start at 97.

"" = 97 = ASCII value is 128
"" = 100 = ASCII value is 134// could be wrong on this one...

// but add this line check for extended charactor.
if (string[i] > 127 ) string[i] = string[i] -31; // should do the trick. If not adjust + or - 1.

Does this help, any...

http://www.opengl.org/discussion_boards/ubb/smile.gif



Originally posted by alex_r:
No, Nehe use a bimap with two fonts, in this bitmap, I can't use these letters, them I try to use one font in bitmap.
It's not just change the picture...



[This message has been edited by nexusone (edited 09-10-2002).]

alex_r
09-10-2002, 06:49 PM
In the program (The NeHe original code), the "" is -57...
And in your line, the error is "Can't convert char * into a int"...

alex_r
09-10-2002, 08:21 PM
I found the problem!!!
I changed the chars position on the picture.

Thanks for all
Alexandre Ribeiro de S

Hurle
09-15-2002, 08:06 AM
Originally posted by nexusone:
Because the Nehe demo uses a bit map with only the English set of charactors.
Once you learn how he put's the charactors on the screen, it will be easy for you to add other's that are used in other languages.



[This message has been edited by nexusone (edited 09-09-2002).]

Where cn I find this Nehe demo for fonts?

Hurle
09-15-2002, 08:24 AM
Originally posted by Hurle:
Where cn I find this Nehe demo for fonts?


Cancel that question. I found it at http://nehe.gamedev.net/tutorials/lesson.asp?l=17
Thanks, Hurle