Sign in to follow this  
Ratman

Font Rendering question

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this