How to make 2 different fonts?
Started by Mike00, Apr 17 2000 07:28 AM
3 replies to this topic
Sponsor:
#2 Members - Reputation: 126
Posted 17 April 2000 - 08:57 AM
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
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
#4 Members - Reputation: 126
Posted 17 April 2000 - 10:49 AM
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
Then you have the possibility to choose between the two fonts with glListBase()
Visit our homepage: www.rarebyte.de.st
GA






