Font engine help (variable printing)

Hi there,

i’ve nearly finished writing a font engine (in opengl surprisingly) but am not sure how to print out the value of variables (i want to use this as a fps counter). can anybody offer some quick advice on how to go about this?

Cheers

Allan

I have written variable printing functionality. I simple made a couple of classes that handles the different variables (float, int, vector) and derived it from an renderable text class.

So say you want to print the float value of an variable. I assigned a pointer to the text object, so It can access the value at each frame. Then it uses GL_QUADS to render the text, using the appropriate char. You simply just cast the float to an int and adjust it so that a 0 gives an ‘0’ char.

I think it is an offset of 48 in the ascii table.

For example, to render an float with 3 decimals.
1 Cast the float to an int and draw the number,
2 subtract the int from the float. Multiply the float with 10
3 repeat 3 more times