Jump to content
  • Advertisement
Sign in to follow this  
CSharper

OpenGL Printing Text with OpenGL in Screen

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

Hi fellows I'm new in OpenGL and I would like to know how can I put a text in screen. I've created a method that creates the font, but I don't know if my method is correct or I forget something. Below the method: void CriaFonte(HDC* hdc, char *c) { HFONT font; glListBase(1000); font = CreateFont(20, 0, GM_COMPATIBLE, 50, FW_DONTCARE, false, false, false, ANSI_CHARSET|DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE,"Arial"); SelectObject(*hdc, font); glCallLists(strlen(c),GL_BYTE, c); } Thanks for help

Share this post


Link to post
Share on other sites
Advertisement
Take a look at this page of NeHe's tutorials. Listed there are three different tutorials concering text, depending on the type you need. I tgoes though step by step how to do what you are looking for and comes with sample code at the end for you to download and work with as well. Good luck!

Share this post


Link to post
Share on other sites
You forgot to create the Display Lists using glGenLists() function I think it is called. You also forgot to create the font into the Lists using wglUse** either BitmapFonts or OutlineFonts. The glCallLists function should go where you actually draw the font, not create it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!