Jump to content
  • Advertisement
Sign in to follow this  
tomba

OpenGL Nehe's OpenGL font ques

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

the tutorial created by nehe for opengl is very helpful, but it uses win32 api to creat a window. i used gult window to create it. nehe uses : 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 The hDC is for win32 window, wut can i replace the hdc to make it work for gult window? can someone post Nehe Opengl Lesson: 13's code using the gult window rather then win32 window? thx

Share this post


Link to post
Share on other sites
Advertisement
there is a better solution in your case than using windows fonts for creating and drawing the text.

What you do is create a texture with the ASCII characters you're going to use lined up sequentially. Then you write a simple function to take a string to be printed, and parse through each character. For each character, you figure out it's ASCII value, and use that to determine where in the texture the character is. Then you draw a quad for each character, with that part of the texture bound onto it.

I think NeHe has a tutorial on it, it's known as bitmap fonts.

Share this post


Link to post
Share on other sites
i could do that, but i find nehe's method lot faster and easier .. i though there might be a way to use nehe's code with gult window

Share this post


Link to post
Share on other sites
Quote:
Original post by tomba
can someone post Nehe Opengl Lesson: 13's code using the gult window rather then win32 window? thx

Assuming you're talking about Glut: Check the downloads at the end of the lesson. There's probably one that uses Glut.

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!