PDA

View Full Version : Writing Fonts To The Screen Help Needed ASAP



roguespear
01-04-2005, 04:50 AM
Hello all,

I am trying to write some text to my screen so i can see the FPS of my program. I have gone through all the tutorials i could find and all of them use a HDC variable of some sort. From what i have gathered these are actually already in the program before the text was needed. Neway i dont have a variable like this in my program and everything runs fine.

My question is what exactly does this HDC (Private GDI Device Context) do because from what i have gathered it is initialised as NULL and doesnt change throughout a program.

Another question is can i get text to my screen without using this variable/method. I have tried introducing it into my program being set to null and calling SwapBuffers(hDC) at the end of my display func instead of glFlush and glSwapBuffers but that leaves me with a blank screen that doesnt refresh.

All help appreciated

Thanx

Aeluned
01-04-2005, 04:54 AM
Maybe this will help you:

http://nehe.gamedev.net/lesson.asp?index=03

roguespear
01-04-2005, 06:28 AM
Hiya m8 i have already looked at nehe's site and that is the tutorial i used. The problem with it is that no where in my program is there a HDC variable called hDC.

i thought fine ill just add it at the top and edit it where nehe edits it. But i cant see newhere in his code where it changes from being NULL. I have gone all the way back to the initial lesson in OpenGL that he does but still do not understand why where it changes.

Can someone help me as this is the only problem i am having understanding the code.

Tom

zukko
01-04-2005, 09:59 AM
i believe the hdc has to stay NULL, go to www.gametutorials.com (http://www.gametutorials.com) for another font tutorial

def
01-04-2005, 11:32 PM
You migth be interested in GLUT which offers text rendering in opengl. Most of the tutorials at http://nehe.gamedev.net/ are also ported to the GLUT library.
You can get GLUT here: http://www.opengl.org/resources/libraries/glut.html

roguespear
01-05-2005, 01:32 AM
Hiya def that was what i was looking for. Did some more research and found out about the glutBitmapCharacter function. So i gave it a go and have just got it to work. I was already using the glut library just didnt know it had the capability of producing text.

Well thanx guys for your input it is all appreciated.

Tom