Advertisement

Lesson 13 - Bitmaped Fonts

Started by April 11, 2003 11:24 PM
2 comments, last by Sarashinai 21 years, 10 months ago
I followed the lesson and I thought I put everything in correctly, but the text doesn''t appear on the screen. I put it all into one function to test but it still doesn''t work. Here is the code, what did I do wrong? HFONT font; mFont = glGenLists(96); font = CreateFont(-24, // Height Of Font ( NEW ) 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 "Courier New"); // Font Name HFONT oldFont = (HFONT)SelectObject(mDeviceContext, font); wglUseFontBitmaps(mDeviceContext, 32, 96, mFont); SelectObject(mDeviceContext, oldFont); DeleteObject(font); glColor3f(0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); glTranslatef(0.0f,0.0f,-1.0f); glColor3f(1.0f, 1.0f, 1.0f); glRasterPos2f(-0.3f, 0.0f); char text[] = "Test Message"; glPushAttrib(GL_LIST_BIT); glListBase(mFont - 32); glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); glPopAttrib(); SwapBuffers(mDeviceContext); glDeleteLists(mFont, 96);
It looks like your deleting the font displaylists you created after rendering them once.
Advertisement
I am. This function was just a test so I could get all the relevant code in one function and post it here. In the normal code the lists don''t get deleted this way and the text still isn''t displayed.
If you are using backface culling try to disable it...

And disable lighting, texturing and the depth buffer when drawing with the font...

This topic is closed to new replies.

Advertisement