Hi all, how do I get the TextRenderer to respect the depth buffer?
I want my text drawn with depth/z = 0 but to respect the depth function GL_LESS. That means it should not overwrite pixels already drawn with depth = 0 and not be overwritten by pixels drawn later with depth = 0.
To be more specific, I am experimenting with OpenGL and was trying to build a basic GUI component (textbox/label) for my application. I have reached the point where I can do a box using gl.glBegin(GL_LINE_LOOP), fill in the background using gl.glBegin(GL_QUADS), and want to use a TextRenderer to render text. However, if I let it disable the depth test using textRenderer.Draw(…) the control’s text draws on top of everthing, even if the box is hidden by something. If I allow depth testing it appears that the text is being drawn with a depth/z value of -0.5 which is behind the control’s background and other images. Neither of these results are desireable.
I also tried using TextRenderer.Draw3D(x, y, z = 0…) and it seems to draw properly, but I get artifacts around the letters, like the letters are on a rectangle with a black background. If I could even get that background transparent that would help. That looks like something to do with drawing textures, but I barely understand textures and I can’t see how to specify texture coordinates and bindings for the text from the TextRenderer