Nehe's OpenGL font ques

Started by
2 comments, last by TomasH 19 years, 8 months ago
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
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.
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
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.

This topic is closed to new replies.

Advertisement