Advertisement

Text / Depth test problem

Started by January 18, 2001 06:23 PM
2 comments, last by Wavarian 23 years, 10 months ago
Urgh.. im having problems. Recently i implemented a skybox. For it, i disabled depth testing so that all the objects after it would be drawn ontop. The problem is with my text. It has to be drawn before the gluLookAt function, whereas the skybox must be drawn after this function. What i end up with, is text which cannot be seen unless the skybox is out of the player''s view, and even then, the text acts as a window through the world, showing the skybox. Text''s colour and other characteristics work perfectly without the skybox''s glDisable(GL_DEPTH_TEST). Anyone know of what i can do to resolve this problem? (1. no, im not getting rid of my skybox dammnit! =P 2. no, im not getting rid of the text) Thanks guyz oh yeah, and i can tell you that it has nothing to do with lighting, texturing, blending nor culling, because my text function disables all of that. -- Wav
its common practice to draw the HUD/text after everything else.

u can turn off depth testing eg
glDisable(GL_DEPTH_TEST) preferable
or keep depth testing enabled and use
glDepthFunc(GL_ALWAYS) slower

http://members.xoom.com/myBollux
Advertisement
Well that doesnt seem to apply to my text routine. My text needs to come directly after:

glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity;

..and before the gluLookAt function. My skybox, of course, needs to come after the gluLookAt function and before any other objects in my scene.

I was hoping that there would be an easy fix for this.. There is no way i can place the text code anywhere else without having it working.

- Wav
well what i described is the standard/best practice as used in quake3 and UT etc.
perhaps

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);

glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity;
glDepthRange(0.0,0.001);
draw text
glDepthRange(0.0,1.0);

http://members.xoom.com/myBollux

This topic is closed to new replies.

Advertisement