What I am trying to do is that as I draw every object, I check to see if it is tagged, and if tagged, write some text near the object, using glRasterPos2f/i to set location on screen, and then glutBitmapCharacter.
For glRasterPos2, I see a lot of examples with pixel coordinates passed as arguments (example: 100,100). Pixel coordinates do not work for me, and instead I have to translate to coordinates on a [-1.0 1.0] scale. [-1 -1] is bottom left of screen, [1 1] is top right.
One thing that I have noticed in the examples is a change to an orthographic projection. Is this the reason for my issue?
I have gluPerspective(); set once at the start, and it is not changed (for now). If I have to change to gluOrtho every time I want to write text at pixel coordinates, it seems messy. For each object, I start in gluPerspective(), and then change if needed to gluOrtho(), and then back again.
Another option I have thought about, is since things seem to work on the [-1.0 1.0] scale, I can manually translate screen coordinates onto the scale. But this also seems messy and bad for performance.
Any advice on how to proceed?