PDA

View Full Version : Moving text along with the primitive objects



Anupama
05-14-2011, 06:55 AM
I am doing a sliding number puzzle. I am able to write the text on the polygon primitive which is basically a square using glRasterPos() and glutBitmapCharacter() but when i try to move the square the text remains in its position whereas i want the text also to move along with the square. What do i do???

Aleksandar
05-14-2011, 09:27 AM
If you are moving your squares in 2D space, then just recalculate position of the text after transforming and draw at that position. But consider using textures. Draw text into the texture and apply texture onto the quad. That will be much easier and you can apply whatever transformation you want. Furthermore, you can generate textures with much better fonts than those provided by glut.