Jump to content
  • Advertisement
Sign in to follow this  
betaisao

3D Text

This topic is 4425 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

How to write a 3D text string in an arbitrary size and direction quickly? I used transform methods like scale, rot, but it slowed down my system seriously. I want to draw 3D co-ordinate with numbers attached to the axis. dev.Material = meshMaterial; tmp = dev.Transform.World; xvalue = 0; yvalue = 0; zvalue = 0; xdiv = 1; ydiv = 1; zdiv = 1; Mesh mx, my, mz; for (int i = 0; i <= div; i++) { mx = Mesh.TextFromFont(dev, localFont, xvalue.ToString(), 0.001f, 0.0f); dev.Transform.World = Matrix.RotationZ((float)Math.PI / 2) * setAxisTransformMatrix(xaxis); mx.DrawSubset(0); xvalue += xdiv; my = Mesh.TextFromFont(dev, localFont, yvalue.ToString(), 0.001f, 0.0f); dev.Transform.World = setAxisTransformMatrix(yaxis); my.DrawSubset(0); yvalue += ydiv; mz = Mesh.TextFromFont(dev, localFont, zvalue.ToString(), 0.001f, 0.0f); dev.Transform.World = setAxisTransformMatrix(zaxis);//Matrix.RotationX((float)(Math.PI / 2)) * mz.DrawSubset(0); zvalue += zdiv; } dev.Transform.World = tmp; Thanks

Share this post


Link to post
Share on other sites
Advertisement
DrawSubset calls DrawIndexedPrimtive internally, and you want to cut those calls to an absolute minimum. 500 per frame will completely destroy your frame rate.
So, you should be using a dynamic vertex buffer and filling it with data once, then rendering all of your text in one call.

How is your text handled? Are all letters completely independant of each other, or are you rendering a string of text, where all letters are in a row?

Share this post


Link to post
Share on other sites
Unfortunately, they are all independent. Each of them is rendered to different positions. Is dynamic vertex buffer useful in this situation? I'll try it anyway. Thanks.

Share this post


Link to post
Share on other sites
Yes, definitely. Using meshes like this is not a good idea. Meshes are really designed to have only a few onscreen, certainly not 3 per letter like you seem to be doing.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!