Overlaying transparent (font) textures

I have a texture font, which is based on Brad Fish’s GlFont, but I’d put it in a class so that it wiggles along a given line.

The characters in the font are black, and transparent using GL_LUMINANCE_ALPHA, so the the line they’re drawn on top of shows through as you would expect. However, the other lines underneath get obscured by the (no longer transparent) white box containing the font character, and if two lines of text cross, then only one of them is visible, and the other gets obscured by the same white boxes. It’s as if the text characters are only transparent over the nearest item (the line), not over anything else. This seems very strange to me, and is no good as I need everything underneath the text (including other text) to appear through.

To achieve the depth effect I’ve enabled GL_DEPTH_TEST, and have given the various lines different z values up to 0.99, and the text is drawn at 0.1.

See point 15.070 here :

And read the whole page while you are at it :slight_smile:

If you can’t sort your primitives back to front, try not to use blending but alpha testing instead. Fragments rejected by the alpha test will not write to the depth buffer. But edges are not bilinear filtered. Your choice.
You can also do both blending and alpha testing.

Thanks, will look into it.

Turns out what I did indeed have my calls in the right order. I had a loop, and was drawing line then text, then repeat, rather than drawing all the lines then all the text. Fixed now, ta!

Sorry, typo, “right order” = “wrong order”!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.