Follow an object

Hi everybody
I am new on this forum and I have a little question: I would like to follow an object on the screen to display text on it (or near it) while it is moving. I manage to write 2D text but I don’t know how to get the position of an object on the screen (not in the space) so I can’t put my text on it…
If anybody could help me please…I am a poor beginner :rolleyes:

Could you give a little more information?
what is your object? does it move around in 3D space?
is it a simple quad translating across the screen?

if you have a vertex of the object in object space you can find where it maps to the screen using gluProject().

If you use font bitmaps which can be generated under Windows with the wglUseFontBitmaps function, you can just set the glRasterPos to the position where the lower left corner of the text should start. The positioin is handled like a vertex.
To print the text, you can set the
glListBase to the base id of the display lists created by wglUseFontBitmaps and use
glCallLists(strlen(myText), GL_UNSIGNED_BYTE, myText);

There’s also wglUseFontOutlines which is real 3D geometry, e.g. used in one of the screen savers on W2K.

Thank you for your answers, I give you a bit more information:
I have 24 spheres in the space and I would like to put a name on each one (2D text). These spheres are just moving on the screen when I change the point of view (of course! :smiley: ), but otherwise it is not moving. I know how to put text on the screen in 2D but I would like to know how I can know where the spheres are on the screen (x,y coordinates) it means where it is projected on the screen.
Thank you again for your answers I will try that.