I am developing one application using MFC and OpenGL.
I am displaying some 3D surface (This surface is determined through my simulation program)
Now I want to measure the length of that surface …(the interface should be similar to that of any CAD package). So what I want to do is I will click the mouse at one particular location and then click on the other…then I should get to know the length between those two points…
Also the other option which I want is the select a rectangular area using mouse click and then find …things like surface area …etc…
So my question is how should I go about getting these clicked points co-ordinates…
Odd - I see your z co-ord is zero? This is surely not correct. You should have a z coord in order to recover the correct x and y for the projection, given the projection z coord.
Usually (often), picking is used to recover a z coord in the buffer associated with a given x, y screen-space coord (your mouse position) - gluUnProject will then recover the correct x, y for that z.
Hope this helps!
(you can use OpenGL selection to get the correct z coord).