I am wondering if anyone has worked much with 2D text in OpenGL (by using orthographic quads)…
My current character image has most of the useful ASCII characters in one 256x256 image…the characters are tiny so that they can fit into the 256x256 image
The problem I have is that the letters look very distorted sometimes…The pixels crowd together sometimes, and other times they dont
Is it better to have 1 image for all the characters, or lets say dividing the characters into 3 sets, each set in its own 256x256 image (meaning that each character can now be drawn bigger in the actual bitmap)
Will this fix up the crowding/distortion problem?
It sounds like your quad verts aren’t getting rasterized consistently. This is a fairly well-known gotcha, and there’s something in the Red Book about how to deal with it - IIRC you use pixel coordinates (ortho size == viewport size) and offset each vert by about 0.375 to keep it away from pixel boundaries.
512x512 is not a very good resolution for Voodoo2’s (which i also plan to support)
Thanks, so you mean that some pixels are being written on top of other pixels??
Another problem I have run into is don’t use mip mapping. We have a system where we generate textures from a true type font and also store the size an offset info in the header of our specialized texture. Then when we read it in we know how to space the characters and how they are located. Mip mapping doesn’t work well with this becuase the linear interpolation might spill into another characters texel space and isn’t necessary since the projection is ortho anyway. To make large text you have to scale the poly’s but of course there is a limit to what will look good and how much you can stretch it. 256 x 256 doesn’t hold a very large font so we have to use 512 by 512 and larger for very large text. It is better to use one texture for the whole font if you can fit it. If you can’t then do what you gotta do to make it work. The reason it is better to use one texture is that a whole string can be drawn from one texture minimizing the texture state changes and giving you better performance.
OH…I think it is the mipmapping thing
I specifically disabled it a while ago for the fonts so that they would show properly but i must have reverted to a previous source version because it is now being mipmapped!!
Old code can be a pain!