• Advertisement

Archived

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

How to make 2 different fonts?

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

In my program, I want two different texts to appear, each a different font. How can I do this? I''m pretty new to openGL Thanks!

Share this post


Link to post
Share on other sites
Advertisement
You can make bitmap fonts in OpenGL using glBitmap().
You can load a font into display lists. With glGenLists(Number_of_letters) allocate enough free display list indices, the function returns the first of them. Then set up the letters into display lists:

glNewList(list_nr,GL_COMPILE)
glBitmap(width,height,0,0,width,0,pointer_to_bitmap_data);
glEndList();

For list_nr you should take the return value of glGenLists() + the ASCII code of the letter. The bitmap is a real bitmap, I mean every bit represents one pixel.

This was the initialization, if you want to write use glRasterPos2i(x,y) to set the ''cursor'' to the right position, then:

glListBase(listbase);
glCallLists(str_length,GL_UNSIGNED_BYTE,pointer_to_str);

If you want to use two different fonts, make the initializasion a second time for the second font, then you can choose with glListBase() which font you want.

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites
Create the two fonts with CreateFont(), call wglUseFontOutlines() two times but before you call it the 2nd time select the second font object, then call it with a different base.
Then you have the possibility to choose between the two fonts with glListBase()

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites

  • Advertisement