🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Lesson 17, how should I do to display a bigger font size?

Started by
3 comments, last by lc_overlord 17 years, 12 months ago
Hi, I'm a newbie with OpenGL and I would like to modify the code of the Lesson 17 to display a text with a font 32x32 (contained in a 512x512 texture bitmap) instead of 16x16 as the example. I did many tries modifying "BuildFont" and "GLPrint" but unsuccesfully, then I'm asking the "Gurus" how I should modify the code to display correctly a font text bigger than 16x16. Thank you, regards. Bob
Advertisement
i might be a little vague, but in BuildFont() the very first param that usually takes -24 is the font size. so if you wanted to change it to 70, make it -70. always make it negative....here ill paste my buildFont() to show you:
void buildFont(){	HFONT font;	HFONT oldFont;	base = glGenLists(96);	font = CreateFont(-24,0,0,0,FW_BOLD,false,false,false,ANSI_CHARSET,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,FF_DONTCARE | DEFAULT_PITCH,					"Arial");	oldFont = (HFONT)SelectObject(hDC, font);	wglUseFontBitmaps(hDC,32,96,base);	SelectObject(hDC,oldFont);	DeleteObject(font);}


hope that helps
--nathan
It should be just to use it, now if you want to make te actual text bigger you need to change the glVertex2i values in BuildFont() from 16 to 32 and the folowing glTranslated(10,0,0); to glTranslated(20,0,0);, or something like that.

lack the hack:
1. that is for lesson13
2. it won't work since wglUseFontBitmaps ignores the fontsize parameter in the logical font created
oh sorry....i didnt know exactly what lesson that was from, only that thats the code i use from nehe for font.
and about wglUseFontBitmaps ignoring the fontsize parameter, i'm not too sure about that since if i want a larger text i make it -70 or whatever, the text is defintlely bigger than before.

--nathan
Well, maybe that's only true for the outline fonts then.

This topic is closed to new replies.

Advertisement