Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

C#
glutSolidSphere(1.0,8,15);
glColor3f(0.0,0,0);
glTranslatef(3,0,-2);
glutSolidSphere(1.0,8,15);



if depth buffer enable
C#
glDepthMask(GL_TRUE);
glDepthFunc(GL_LEQUAL);


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
Posted

1 solution

The Z buffer holds a value for *every pixel* that has been rendered, not per object

Apart from that, you are correct
 
Share this answer
 
Comments
Sweety Khan 24-Oct-11 10:21am    
thank u so much :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900