Jump to content
  • Advertisement
Sign in to follow this  
q0987

How to draw text on top of a 3D object?

This topic is 3492 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, I use function auxSolidSphere to draw a sphere and would like to draw a text on top of the sphere. What should I do to implement this feature. glPushMatrix(); glTranslated(pos[0], pos[1], pos[2]); // pos is the location of sphere auxSolidSphere(1.5f); glPrint3D(pos[0], pos[1]+1.5f, pos[2], "100"); glPopMatrix(); void glPrint3D(float x, float y, float z, const char *string) { glPushMatrix (); glColor3f (1,1,1); glRasterPos3f(x, y, z); for (int i = 0; string != '\0'; ++i) glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, string); glPopMatrix (); } Thank you -Daniel

Share this post


Link to post
Share on other sites
Advertisement
I dont know if there is a simpler way... but you could render the text to a render target and then apply that to the spheres texture using multi-textruing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!