Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zombie

SLOW Text in DirectX

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

Why oh why it's so slow to write simple text in DirectX (DirectDraw)? I have to write 100 entries to screen, and no matter what I do, the program is slow ( <20 fps). This is the code I use- about 150 fps without writing text
Public Sub DrawStars()
Dim xx As Integer, xy As Integer
 Call g_d3dDevice.SetTexture(0, Stars(xi).texture)
 TransculensyOn

 For xi = 1 To Numstars
  xx = Stars(xi).sRect.X1 + (Stars(xi).wdh / 2) - (TextWidth(Starnames(xi)) / 2)
  xy = Stars(xi).sRect.Y2 + (Stars(xi).hgt / 2) - (TextHeight(Starnames(xi)) / 2)
  call g_ddsbackbuffer.drawtext(xx,xy,Starnames(xi),false)

  Call g_d3dDevice.DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX, Stars(xi).vertex(0), 4, 0)
 Next
 TransculensyOff
End Sub
 
Edited by - Zombie on 4/21/00 5:01:35 AM

Share this post


Link to post
Share on other sites
Advertisement
There may be some slowdown between swapping from a 2D function (DrawText) to a 3D function (DrawPrimitive). The device may have to do some internal state changing. And if DrawText calls the GDI to do the drawing, as I suspect it does, that will make it even slower. Perhaps using DrawText to render an alphabet onto a texture surface at the start of the program, and then writing something to render individual letters from there would be quicker (but more work, of course!)

Besides which, I expect you would be better off batching all the DrawPrimitive stuff into 1 call, to eliminate overhead, even though you might have to use triangle lists instead.

Share this post


Link to post
Share on other sites
Well... ummm bad news, DrawText from what I can tell does actually call Lock, GetDC, TextOut, Unlock.... simple but very inefficient....

Better to make your own function, write a DLL, or just make your own characther function to bit from a characther sheet.

You making a VB game too? Cool....

-------------------------
-Now Working on Pokemon like Engine!

Share this post


Link to post
Share on other sites

  • 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!