HUD like fonts

Hello,

Not sure if this is advanced or not but I wondering are there any functionality for displaying 2D fonts that always face the user, regardless of camera location, movement etc? I started to add 3D elements and position the “camera” in different places. The text that were drawn with drawString() naturally moved as well. I looked at the code for drawString and realized why after since the text is just being placed in the scene just like any other object. Any way to simply do this with the current framework? I guess kind of like the bitmap font example in one of the nehe tutorials.

Thanks!
m

Hey actually there are two solutions:

The easy one is to use the ofDrawBitmapString() command in ofGraphics which is basically exactly like the nehe bitmap type tutorial.

The other way is to wrap all your openGL transformations with

glPushMatrix();

… some code

glPopMatrix();

//then draw type here.

This will preserve your view position so that stuff drawn after will not move based on previous transformations. This should work for you - except it might not if you are actually messing with the gluLookAt( function.

Either way you should be able to do what you are after no problems. Be aware though that on some graphics cards bitmap type can really slow things down A LOT so it isn’t a great option for a public release.