Is depth buffer not working ?

Started by
12 comments, last by JeffreyChen 12 years, 9 months ago

You say your objects are texture mapped cubes?

What I see is that your cubes are overlapping each other and for that reason hiding objects drawn after them.

I don't exactly understand the shape of your objects and what kind of texture each object has.

For me it seems that your z-buffer is working correctly.

Seems that you could solve the problem by drawing your objects back to front order.
However, that is probably you want to avoid since you are using z-buffer.

Can you elaborate a bit your objects (like show them closer or from different angles and show the real geometry in wireframe) ?

Cheers!


My objects are cubes but with textures drawn in isometric view and then mapped to it like a paper over the cube in 2d space.

So is the drawing order important ... I thought the z buffer should take care of the drawing order
When I turn my view the image is distorted ... I can fix that by drawing textures for each quadrant ... and applying the texture to respective vertices..
Advertisement

Alpha channel and alpha testing is what you are looking for-


Ok, seems that you have alpha channel for your textures. Check that you use alpha testing to clip transparent pixels.

Cheers!


How do I clip transparent pixels ? u mean clip the geometry ?
The z-buffer will do the work, but you must not draw the transparent parts of the cubes.

You'll need to use alpha testing (or what ever it is called under opengl). This way your z-buffer will remain untouched for fragments with zero alpha and thus will make your drawing order independant.

Cheers!


Edit:

Alphafunc


Clip pixels, not geometry
This did the trick ..
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,0.1f);

Thanks Kauna and gsamour

This topic is closed to new replies.

Advertisement