mungunbat

09-01-2012, 10:43 PM

Hello everyone this is my first thread. I`m a new to Opengl. I am recently trying to figure out how the depth buffer works. right now my task is to find the depth value in object space from window space. My camera is located in (0, 0, 2) point and it is looking at (0, 0, 0) point. Near plane distance is 1, far plane distance is 3, which i believe near plane should be at (0, 0, 1) and far plane should be at (0, 0, -1) in eye space.

Window space has Z component which should be in an interval [0, 1] by default right. So if i transform a point (someX, someY, 0) from window space to object space by using gluUnproject , z component of the result point in object space must be equal to (someXX, someYY, 1) in object space. And z component of a point in window space is equal to 1, then the transformed point should be -1 right??? BUT, my result is when the z buffer is equal to 0 the result was the value( = 1) I expected. but if i set z to 1 then the result was -0.33. WHICH i don`t get it all? please help i`m stuck here for all day and couldn`t move forward.

Window space has Z component which should be in an interval [0, 1] by default right. So if i transform a point (someX, someY, 0) from window space to object space by using gluUnproject , z component of the result point in object space must be equal to (someXX, someYY, 1) in object space. And z component of a point in window space is equal to 1, then the transformed point should be -1 right??? BUT, my result is when the z buffer is equal to 0 the result was the value( = 1) I expected. but if i set z to 1 then the result was -0.33. WHICH i don`t get it all? please help i`m stuck here for all day and couldn`t move forward.