Jump to content
  • Advertisement
Sign in to follow this  
evef

OpenGL 3D Font only displays first character of alphabet

This topic is 5458 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

Hi, I am trying to create a 3D font using wglUse font outlines. I have followed the tutorials from NeHe and MSDN but their code does not work in my program. When it comes to printing the text using glCallLists() only the first letter of my font "alphabet" is displayed - in this case the character "!" as I start from 33. This happens regardless of the contents of the string I wish to print. What am i doing wrong? Why won't it print my text? Here is the method I use for creating and displaying the font. void TOpenGLWidget::create3DFont() { // Get the DC for the current rendering context. HDC hdc = wglGetCurrentDC(); HFONT font; // Windows Font ID GLYPHMETRICSFLOAT gmf[256]; // Address Buffer For Font Storage // Windows Font ID GLuint base = 1000; font = CreateFont( -12, // 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 "Comic Sans MS"); // Font Name SelectObject(hdc, font); // Selects The Font We Created wglUseFontOutlines( hdc, // Select The Current DC 33, // Starting Character 96, // Number Of Display Lists To Build base, // Starting Display Lists 0.0f, // Deviation From The True Outlines 0.2f, // Font Thickness In The Z Direction WGL_FONT_POLYGONS, // Use Polygons, Not Lines gmf); // Address Of Buffer To Recieve Data // Set up transformation. glLoadIdentity(); glTranslated(0.5, 0.0, -2.0); glListBase(1000 - 33) ; glCallLists(5, GL_UNSIGNED_BYTE, "Hello") ; The only thing that i can think of is that the create3Dfont() method is called from within a method where a list of other objects is being created. Any ideas would be greatly appreciated. Thanks Eve

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!