Font Rendering question

Started by
1 comment, last by Ratman 17 years, 6 months ago
Im currently using Free Type to extract font pixel information and blit it to a DX texture. My question is when it comes to rendering each character to a textured quad on screen - what is the best way of doing this? The obvious seems to have a vertex buffer for a triangle strip, fill it out with the proper data and punt it down draw primitive. Is this efficient though? This would require locking/unlocking a vertex buffer each time that I draw text to the screen. I guess thats what D3DUSAGE_DYNAMIC is for, but Im just hesitant to do this as its ingrained in my head to minimize locking/unlocking vertex buffers. The only other option I see is using like D3DXSprite interface, which in the end is probably doing the same thing as described above. Im wondering though if it has any extra optimizations going on behind the seen that would make it a better choice? Any suggestions? Maybe Im overlooking something, just thought I'd toss this out before I got too deep. Thanks
Advertisement
Dynamic VBs are quite happy being locked every frame, so you shouldn't have aby problems with them. What both I and ID3DXFont do, is render the letters to a texture as needed, and then lock-fill-unlock a dynamic VB (ID3DXFont uses ID3DXSprite to do that), and render a triangle list.

So long as you use a dynamic VB, and possibly a dynamic texture (Depending on how often you load / preload glyphs, and how you get them onto the texture), you should be fine. Both ID3DXFont and I both use static textures.

I did a bit of poking about in ID3DX internals a month or so back, and posted the results in My Journal, if it's any interest.

Cheers,
Steve
Thank you sir, thats just what I wanted to hear. Also your journal is very helpful :D

This topic is closed to new replies.

Advertisement