Original Post
Hi!
On the advice of a friend,I am now posting a few functions here,this is not my exact project as it is all jumbled up because I have to display text in almost every function,but once this problem is solved,I would be really happy to share it with you guys.
Anyway,
this is NeHe's lesson 13,I have jsut modified the build font function to take font height as an argument.
I do have removed the buildfont and kill font calls from initGl(),and KillGLwindow().......
other then that,I have practiaclly done nothing at all....just taking advantage of whatever people have done so far.
So,
this is pretty much the whole story,if anyone can help me out please do because I have to finish it in time.
[edited by - fahad salim on January 2, 2004 7:29:40 AM]
GLvoid BuildFont(GLuint x) // Build Our Bitmap Font
{
HFONT font; // Windows Font ID
HFONT oldfont; // Used For Good House Keeping
base = glGenLists(96); // Storage For 96 Characters
font = CreateFont( x, // Height Of Font
0, // Width Of Font
0, // Angle Of Escapement
0, // Orientation Angle
FW_BOLD, // Font Weight
FALSE, // Italic
FALSE, // Underline
FALSE, // Strikeout
ANSI_CHARSET, // Character Set Identifier
OUT_TT_PRECIS, // Output Precision
CLIP_DEFAULT_PRECIS, // Clipping Precision
ANTIALIASED_QUALITY, // Output Quality
FF_DONTCARE|DEFAULT_PITCH, // Family And Pitch
"aerial"); // Font Name
oldfont = (HFONT)SelectObject(hDC, font); // Selects The Font We Want
wglUseFontBitmaps(hDC, 32, 96, base); // Builds 96 Characters Starting At Character 32
SelectObject(hDC, oldfont); // Selects The Font We Want
DeleteObject(font); // Delete The Font
}
And,then I call the Buildfont function in drawGLScene function and after I have printed the text I want,I call the Killfont function,and when I run it,the application crashes.(If I dont use teh killfont,it creates so many fonts that ram is eaten up)