Problem with depth buffer(I suppose)

i’m having the following problem:
in my scene i have a cylinder (made with gluquadricobject etc) and let’s say a teapot(glutsolidteapot). the cylinder runs through the teapot. when i use gluperspective the teapot looks broken,distorted, sth like noise in the color or such.when i am not using depth test it doesn’t happen,the teapot seems to be in front of the cylinder though.
I am using VS.NET
Any ideas?

I’m not sure from your description, but you say the teapot looks broken? Do you mean that you can see jagged edges, like shark teeth, at the places where the teapot and the cylinder intersect?
If this is the case then it may indeed have something to do with the depth buffer. This is known as “stiching” or “Z-fighting”. When the depth values of the object that is currently drawn closely matches that of the objects that are already drawn (which are recorded in the depth buffer) the renderer may determine for a few pixels that the current object is in front and decide that is not for the next few pixels. This results in these stiches.
Try increasing the value of cDepthBits in the pixelformatdescriptor. If this doesn’t work try decreasing the far-value in gluPerspective to make the depth buffer cover a smaller range and thus make it more accurate.

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