XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Text in World, Sprite/Mesh? Help a noob!

Last post 05-14-2008 11:21 AM by Joel Martinez. 1 replies.
  • 05-14-2008 10:43 AM

    Text in World, Sprite/Mesh? Help a noob!

    Hello,

    I hope I have this in the right forum.  Here goes.

    I've recently started a project that involves a map with targets on it using DX9.  I've gotten down the basics, but I am having problems with rendering text.  Each target has an identifier and an altitude associated with it, and I need that text rendered alongside it.  I started by using mesh.textfromfont, but dynamically creating even a single label every loop, using an idle-render loop, increases my CPU usage dramatically.  There is no way I can use this for 100 or so targets.  I've looked into sprites for drawing the text, as it needs to be 2D, however, my problem is that I need the text at a certain location in the world.  Is it possible to use sprites with world coordinates?  I guess what I'm really asking is the best way to draw 2D text using world coordinates rather than screen coordinates?  Could someone point me to some sample code?  Thanks, SMJ!

  • 05-14-2008 11:21 AM In reply to

    Re: Text in World, Sprite/Mesh? Help a noob!

    maybe you could draw all individual labels to one texture, then use that texture to draw a series of billboarded quads, each with different UV coords that correspond to the correct label.  The billboard could simply be positioned next to whatever target the text needs to be next to.

    Joel Martinez - XNA MVP  
    Blog: http://codecube.net
    Play Videos on an XNA Texture: Scurvy Media
    XNA Unit Testing: Scurvy Test
Page 1 of 1 (2 items) Previous Next