z缓冲区是否存储对象的z值? [英] does the z buffer stores the z value of an object?
问题描述
我做了2个球体.第二个球体是通过平移第一个球体,在x轴上平移3个单位和在-z aixs上平移2个单位而制成的.这是代码
i made 2 spheres. second sphere is made by translating the first, 3 units on x-axis and 2 units on -z aixs. this is the code
glutSolidSphere(1.0,8,15);
glColor3f(0.0,0,0);
glTranslatef(3,0,-2);
glutSolidSphere(1.0,8,15);
如果启用深度缓冲区
if depth buffer enable
glDepthMask(GL_TRUE);
glDepthFunc(GL_LEQUAL);
绘制第一个球后,深度缓冲区具有第一个球的z轴值.在绘制第二个球体glDepthFunc(GL_LEQUAL)时;检查存储的深度缓冲区值是否等于第二球体的值,如果小于第二球体绘制的像素,否则不进行绘制.
这就是我所了解的有关深度缓冲区工作的全部信息.这是正确的吗?如果m错误,请plz正确
after first sphere is drawn, depth buffer has z-axis value of first sphere. while drawing second sphere glDepthFunc(GL_LEQUAL); checks stored depth buffer value to the second sphere''s value, if it is less than it draws tht pixel other wise not.
this is all wht i understand about depth buffer working. is this right? plz correct if m wrong
推荐答案
Z缓冲区为*已渲染的每个像素*(而不是每个对象)保存一个值
除此之外,你是正确的
The Z buffer holds a value for *every pixel* that has been rendered, not per object
Apart from that, you are correct
这篇关于z缓冲区是否存储对象的z值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!