Results 1 to 3 of 3

Thread: SLOW Text in DirectX

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    29

    Unhappy


    Why oh why it's so slow to write simple text in DirectX (DirectDraw)? I have to write 100 names 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 DXOText(xx, xy, Starnames(xi), g_ddsBackBuffer)

    Call g_d3dDevice.DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_TLVERTEX, Stars(xi).vertex(0), 4, 0)
    Next
    TransculensyOff
    End Sub

  2. #2
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355
    hmm yeah, it's not good Im afraid:
    DirectX uses GDI32 to draw text (if you use directx in C++ you'll see - you have to use surface->GetDC then TextOut).
    Anyway, this means it's slow. One thing you could do is try having a bitmap with every letter of the font on it, and draw them normally, but you'd be doing so many blits it's be slow
    buzzwords are the language of fools

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    29
    From DirectX Help file
    There are much better ways to draw text into a DirectDrawSurface, and the only point of this sample is to show exactly how to lock and access the video memory directly.
    What these ways could be?? Any ideas?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width