Advertisement

FAST 2d font method

Started by February 11, 2001 08:51 PM
4 comments, last by MrSandman666 23 years, 9 months ago
Right now I''m using NeHe''s 2d Bitmap Font method from lesson 13 to do the 2d text in my program. I was only displaying the framerate with it, so there weren''t any problems. But now I display all kinds of statistics with it, which results in 15 calls of my print function (or NeHe''s... almost same thing). And I noticed, these 15 calls make my framerate drop from 250 fps to 35 fps. Now, is there anything faster out there? I don''t want to sacrifice about 700% of my performance to some text. Thanx in advance. ----------------------------- "Mr Sandman bring me a dream"
-----------------------------"Mr Sandman bring me a dream"
Lesson 13 is the wrong way to do text in OpenGL. For one is uses glRasterPos() and there are calls to cosine and sine in it, which is not needed at all. Also, it uses that Win32 CreateFont() call which I assume is going to kill your performance. If you want to do text in OpenGL use a texture map that has the characters on it and draw textured triangles. Try looking at the library here : http://nate.scuzzy.net/gltexfont/ There is also a C++ class if you are using C++. It is opensource so you can look at its guts.

SgtBaker
Advertisement
also check out my opengl appwizard (only for vc6) it shows the correct way of doing tex in opengl ie with a HUD

http://members.xoom.com/myBollux
Bitmap fonts can be slow on consumer level cards but can be used for some tasks. MS, SGI, GLUT and textbooks like the red book all supports bitmap fonts.

I would have switched to ortho projection in tutorial 13 but SgtBakers opinons seems to be some missunderstandings.

The NeHe tutorials that covers fonts is very good and are together with MSDN what the FAQ recommends:
http://www.frii.com/~martz/oglfaq/
Win32 Outlined fonts are slow because they are drawn as a bunch of points as a display list.

bitmap fonts such as in NeHe''s tut, texfont, or PortaLib are quick because they are just textured quads.

using the LMNOpc font builder you can create bitmap fonts from windows fonts real easy.



~~~
Cheers!
Brett Porter
PortaLib3D : A portable 3D game/demo libary for OpenGL
~~~Cheers!Brett PorterPortaLib3D : A portable 3D game/demo libary for OpenGLCommunity Service Announcement: Read How to ask questions the smart way before posting!
Check Download section on my site. There is a example.

========================
Leyder Dylan
Site : http://slug-production.ibelgique.com
E-Mail : dylan.leyder@ibelgique.com

========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/

This topic is closed to new replies.

Advertisement