no depth when using GL_ALPHA_TEST

Started by
1 comment, last by klepto2 15 years, 3 months ago
hi, i've started to integrate shadowmapping in my 3d engine. The engine uses almost fixed function with the ability to use shader. After setting up my depth FBO everything seems to be fine. The depth values are correct. at least for normal objects. If i try to render Alpha masked shadows then they don't whole mesh doesn't write anything in the depthbuffer. the depthbuffer FBO is set up like the one from ATIs SDK. If the textures are masked I use: glEnable(GL_ALPHA_TEST) and on initiation I define the glalphafunc to be GL_LEQUAL,0.5 well, the textures are diplayed correctly but the mesh is not displayed in the depthbuffer. If i disable GL_ALPHA_TEST the whole match is shown in depth, but eg trees or grass needs masked textures. Any ideas?
Advertisement
If you use alpha testing, then fragments that don't pass the test aren't rendered.
Fragments that pass, they get rendered so you get something in depth buffer.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
hi, thx for your answer. Thats exactly what i thought, too. But instead I get this:

no depth as you see


As you see the tree is not written to the depthbuffer. And I have no idea why. Depthtesting and zwriting is enabled. Maybe a driver bug. I will test it on other gfx cards today. btw. I'm using ATI.

[Edit]

Just tested in on nvidia and it works. I will send a report to ATI.

This topic is closed to new replies.

Advertisement