Game Development Community

Can only draw text to integer positions?

by Ken Pajala · in Torque Game Builder · 07/11/2006 (8:31 pm) · 2 replies

I just started fooling around with fonts, and they're quite cool so far, especially combined with the T2D Text Display Class.

My one gripe is that it seems that you're forced to only draw to integer positions since dglDrawText() and such only accept integer points, so slowly sliding text across the screen looks very jerky. It was easy enough to modify the functions to take float points, especially since the actual rendering converts everything to float anyway , but I don't understand why the functions would limit themselves to integer positions in the first place.

Just puzzled is all...

#1
07/12/2006 (9:00 am)
Okay, not quite as easy as I first thought. It 99% works, but there are clamping issues with the edges of letters since AFAIK font letters are placed in textures that are exactly the height and width of each letter, so drawing at fractional positions can cause slivers of the next letter to be drawn. It takes some twiddling to get it to work.
#2
07/12/2006 (10:45 am)
I think you'll have an easier time of this modifying the dglDrawText function and using the world matrix to change the position. As you said it does align things to integers, but it could probably be modified very easily. I suggest the matrix approach because that should eliminate the issues with the slivers getting cut off of letters.