Archived

This topic is now archived and is closed to further replies.

Bitmap Font Problem(NeHe Tutorial 13)

This topic is 5012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In messing around with drawing text on the screen the way Tutorial 13 teaches you to; I noticed that when the text goes off the screen to the left or to the bottom, it doesn't show the text at all. Is there a way to tell OpenGL to blt the text that would show up anyway? I noticed that if you called glPrint() multiple times it would draw the text and keep up with the "cursor" position so that multiple calls would produce text on the same "line". I tried drawing the text a character at a time, but apparently if the coords are too far left or down, then it doesn't keep up with the "cursor" position. Thanks, - Eck [edited by - Eck on March 25, 2004 10:41:44 AM]

Share this post


Link to post
Share on other sites
You can get the width of your characters and the spacings between it by using some font functions.

If you''re programming on windows, read this (MSDN):

-----------------------------------------------------
The GetCharABCWidths function retrieves the widths, in logical units, of consecutive characters in a specified range from the current TrueType font. This function succeeds only with TrueType fonts.

BOOL GetCharABCWidths(
HDC hdc, // handle to DC
UINT uFirstChar, // first character in range
UINT uLastChar, // last character in range
LPABC lpabc // array of character widths
);
Parameters
hdc
[in] Handle to the device context.
uFirstChar
[in] Specifies the first character in the group of consecutive characters from the current font.
uLastChar
[in] Specifies the last character in the group of consecutive characters from the current font.
lpabc
[out] Pointer to an array of ABC structures that receives the character widths, in logical units. This array must contain at least as many ABC structures as there are characters in the range specified by the uFirstChar and uLastChar parameters.
Return Values
If the function succeeds, the return value is nonzero

If the function fails, the return value is zero.

Windows NT/2000/XP: To get extended error information, call GetLastError.
----------------------------------------------------------------
The ABC structure contains the width of a character in a TrueType font.

typedef struct _ABC {
int abcA;
UINT abcB;
int abcC;
} ABC, *PABC;
Members
abcA
Specifies the A spacing of the character. The A spacing is the distance to add to the current position before drawing the character glyph.
abcB
Specifies the B spacing of the character. The B spacing is the width of the drawn portion of the character glyph.
abcC
Specifies the C spacing of the character. The C spacing is the distance to add to the current position to provide white space to the right of the character glyph.
---------------------------------------------------------------





x = rx ( 1 - x ) ; r > 3.5699
... and chaos may begin ...

Share this post


Link to post
Share on other sites
quote:
Original post by Lord_Jake
x = rx ( 1 - x ) ; r > 3.5699
... and chaos may begin ...


lol, what's even cooler is when you plot that function with 3 < r < 4. You interate the function a few hundred times for each r and plot each point.


[edited by - DudeMiester on March 26, 2004 8:56:33 PM]

Share this post


Link to post
Share on other sites
*lol* dont tell me about bifurcation and the Feigenbaum diagramm... Read the book from Ott: Chaos in dynamical systems.


x = rx ( 1 - x ) ; r > 3.5699
... and chaos may begin ...

Share this post


Link to post
Share on other sites