Some advise on bitmap/font

Hi, I’m pretty new to C++ and OpenGL, so I need some tutorials and advise on how to do this. :slight_smile:

I have a (coloured) font from a game in bitmap (GTA2 in case you wonder) and I have a program that can read a string someone types into a textbox. The text someone types needs to be converted to the GTA2 font on display/screen and afterwards be able to be saved as .png.

I already have program doing the converting (no display) with Imagemagick, but I want it faster and on display/screen, that’s why I choose (to rewrite it in) OpenGL.

I tried glBitmap and glDrawPixels, but read somewhere they are not advised? Or?

I don’t need 3D font stuff.

it is usually faster to load your font as a texture, then setup a list of quads with the texture coordinates which map into the right char on that texture, and with the right position, and then call draw for your entire text.

calling glbitmap/gldrawpixels for each character is inefficient because you will pay for driver overhead for each char, instead of for the entire text.

Thanks. That sounds like a good idea.

If I got it correctly, I make for each character a texture in the memory with a custom ID (probably the integer value of the character). I have 149 for one font and got perhaps two other fonts also. Is there a maximum amount of ID’s? 999 perhaps? Then for each characters in the text string I display the texture on a plane on the screen. After that I do a glReadPixels.

I also want to do coloring on the font, is it possible to add a plane over certain parts of the text and assign the layer mode of “color” (just like in GIMP, it takes the hue and saturation values of top layer)?

Do I also need to delete the textures from memory just before quitting the program, or does that go automatic when you quit?