PDA

View Full Version : Draw a text in a window



04-25-2002, 11:12 AM
I have a problem on drawing a text in a window.
When I draw a text that can be completely located in a window, I have no problem at all. However, when I draw a text starting out of a window and ending in a winow, I have a problem. I can't see anything in a window. I think a part of the text must be drawn in a window.

Anybody has a clue to fix this problem?

J.

Furrage
04-25-2002, 12:56 PM
Are you using bitmap fonts. If so the starting position is determined by glRasterPos(). If the rasterposition is off screen it becomes invalid and nothing depending on raster position gets drawn until the rasterposition is set to a valid position again.

04-26-2002, 03:56 AM
Thanks for your reply.

If so, what can I do to draw a text starting off screen and ending on screen?

Change bitmap font to others?
Manual calc to get a starting character on screen?
???

J

nexusone
04-26-2002, 05:27 AM
One solution would be to draw the text using a texture map(see nehe.gamedev.net for example). You apply the text texture to a quad and just translate it into the screen to provide the scrolling effect also this way you can use any font.

The other way is with the bitmap and using a text string. Just move the starting point in which you print the text from the string.

char *My_text[]="Welcome to the machine!";

W = 0.....!=23

x // is the point on the string you wish to print, to give a scrolling effect.
print first pass x=23 "!"
next pass, print x=22,23 "e!"
repest until you have scrolled the text on to the screen, repeat same as it goes off the screen, except start decreasing numbers.

print_to_screen(My_text[x]);



Originally posted by JHome4U:
Thanks for your reply.

off screen and ending on screen?

Change bitmap font to others?
Manual calc to get a starting character on screen?
???

J

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

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