Trouble with fonts

Started by
3 comments, last by rexizt 21 years, 6 months ago
I''ve made a font class wich is avaivable at www.databakeriet.no/eirikhm/cfont.h and www.databakeriet.no/eirikhm/cfont.cpp Can anyone give me a hint on what I''m doing wrong?
"may the source be with you"
Advertisement
what makes you think you''re doing something wrong?
The text won''t appear? I''ve went over the code several times looking for the problem, but I can''t find it.
"may the source be with you"
did you try comparing your code with nehe''s code?
NeHe has an excellent tutorial on it which will solve your problems. Once you get it working, then make changes. You have a huge block of remmed code with no indication that it worked before you tried to modify it.

I recommend taking a look at the DX 8.1 D3DFont.cpp and porting it''s font creation routine to OpenGL. You just need some basic knowledge of Win32 to get the font surface the routine creates to an OpenGL texture. I used GetPixel and manually wrote the pixels with the alpha value to the data array to remove the background color and then created the surface using the data.

With NeHe''s (what you''re doing as well) method it dropped my framerate 100fps or more when even just a few lines of text were put on the screen. It rendered my app unplayable on my 400Mhz not so craptop.

Using DX 8.1''s font routine as a guide you can get the same results (user specificed font variables) but by using a texture instead which causes a drop of only 10fps or less with the same amount of text on the screen. It''s now playable at 150fps on the not so craptop and only drops to ~30fps when it''s loaded up with primitives in game making it quite playable.

Ben


IcarusIndie.com [ The Rabbit Hole | The Labyrinth | DevZone | Gang Wars | The Wall | Hosting | Tiberian Merchandise!!!! | GameShot ]

This topic is closed to new replies.

Advertisement