Sign in to follow this  
adnankhan

Big Font with glBitmap ?

Recommended Posts

I want to display text (mainly numbers) with glBitmap, I am using an array containing the pixel data, but the text displayed is too small. How can I make it large MY CODE static GLubyte Font[][14] = { { 32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, { 33, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }, ...................... ...................... { 125, 0x00, 0x00, 0xf0, 0x18, 0x18, 0x18, 0x1c, 0x0f, 0x1c, 0x18, 0x18, 0x18, 0xf0 }, { 126, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x8f, 0xf1, 0x60, 0x00, 0x00, 0x00 } }; ----------------------------------------------------------------- glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes); glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst); glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength); glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows); glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels); glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); for(i=0;i<len;i++) { unsigned char ch = str[i]; if(ch==0) /* end of string */ break; if(ch < 32) continue; if(ch > 126) continue; ch -= 32; glBitmap(8, 13, 0.0, 1.0, 15.0, 0.0, &Font[ch][1]); } glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst); glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength); glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); ----------------------------------------------------------------- Thank you in Advance

Share this post


Link to post
Share on other sites
I think glPixelZoom won't work with glBitmap, but you can try it and see if it does. Otherwise, you have to make a new font and fill the Font array with the new data. The data you have is a fixed size font (looks like a 8x13 font), so if you want a larger font, you have to make a new bitmask.

Share this post


Link to post
Share on other sites
Paint Shop Pro can export 1-bit bitmaps, so just paint your letters there, save the images and load them in your program. A format specification for the BMP format can be fount here.

But there probably exists some program designed for this already, but I don't know. Search Google and see if you can find something.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this