Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Esap1

Nehe's Bitmap Font Tutorial.

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

Im using the code from Nehe''s Bitmap Font Tutorial, it draws 2d Character on the screen in OpenGL. But I cant figure out how to get the font over the 3D Objects in the Scene. Im trying to create a Console for the Engine, is this the way I should be drawing text, is it fast enough? thanks a lot!

Share this post


Link to post
Share on other sites
Advertisement
To get your text to show up on top, you have to do two things:

1) Draw the text AFTER drawing all of your 3D objects

2) Disable OpenGL''s depth test before drawing the text:
glDisable(GL_DEPTH_TEST);

Hope that helps!

Share this post


Link to post
Share on other sites
I''ve written text with bitmap fonts in VB, but it''s quite slow, with text about 45 fps, without 120 fps. So could someone tell how it works fast?

Share this post


Link to post
Share on other sites
Zombie - What do you mean you''ve written text using bitmap fonts? Do you mean you''ve used the windows GDI but specified a non true-type font?

I believe what Esap1 is referring to is more like...having one image that contains all the characters in the alphabet and is drawn by grabbing a certain area of the image for a letter - some type of lookup table is used to determine which area of the image to grab.

The only example I''ve seen is at www.nukesoftware.com - the nukeDX libraries. It''s called AAFont.cpp and AAFont.h and produces a bitmap font and all the offset information from a true type font. You''ll have to know how to read C++ to figure out what''s going on, and even then it''s a bit complicated. The source actually draws an antialiased font which is nice, but needs access to the actual bytes in the destination image... in VB you can probably do it using the function... err... called DDSurface.GetLockedPixelArray?

Clay

Share this post


Link to post
Share on other sites
I mean I''ve made a bitmap file (*.bmp) of each character in a font, and my "game" is using those files as textures. This might sound stupid, but it''s not my fault that the normal style writing text (ddsurf.drawtext) to screen is so slow!
But however, the way I''m doing it is too slow. I''d really appreciate if someone would write a function to draw text in pseudocode

Share this post


Link to post
Share on other sites
Text is just slow Not much you can do about it at first sight.
Microsoft''s GDI functions ( TextOut ) can slow performance of even a normal, business app down to a crawl with a bad video card ( read: TNT2, GOD those things are crap at standard 2D windows performance ).

Only things to improve it that I can see are:
- Do all your textout at once, so you won''t be textureswapping too much.
- Try to do it in a place where you don''t need any additional coverage testing or clearing, just clear a rectangle, draw the background bitmap, and dump in your text.

#pragma DWIM // Do What I Mean!

~ Mad Keith ~
**I use Software Mode**

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!