Mat
05-08-2002, 12:08 AM
Hi,
I pick up some objects coordinates with gluUnproject I have some trouble to get some points depending on the Z position..
I defined my gluPerspective like that:
glu.gluPerspective(Angle_View_Degree, width/height, 10.0f, 500.0f);
Near plane = 10;
Far plane = 500;
I move in my plane using glTranslate(X,Y,Z)..
If my Z is -10 I will put the value 0 for my gluUnproject z value like this:
glu.gluUnProject((double)X,(double)Y,0,mvmatrix,pr ojmatrix,viewport,x,y,z)
and if my Z is -500 I will give the value 1 to gluUnproject z value.
When I use it like that gluUnproject gives me the correct values ..
Now I want to use it for a Z value between 10 and 500. We can take the middle value 255.. For this Z value I gave to gluUnproject z the value 0.5 but here it does not work ... It does not give the correct object coordinates...
Is there anybody who knows why it does not work ?
Thanks a lot
Mat
I pick up some objects coordinates with gluUnproject I have some trouble to get some points depending on the Z position..
I defined my gluPerspective like that:
glu.gluPerspective(Angle_View_Degree, width/height, 10.0f, 500.0f);
Near plane = 10;
Far plane = 500;
I move in my plane using glTranslate(X,Y,Z)..
If my Z is -10 I will put the value 0 for my gluUnproject z value like this:
glu.gluUnProject((double)X,(double)Y,0,mvmatrix,pr ojmatrix,viewport,x,y,z)
and if my Z is -500 I will give the value 1 to gluUnproject z value.
When I use it like that gluUnproject gives me the correct values ..
Now I want to use it for a Z value between 10 and 500. We can take the middle value 255.. For this Z value I gave to gluUnproject z the value 0.5 but here it does not work ... It does not give the correct object coordinates...
Is there anybody who knows why it does not work ?
Thanks a lot
Mat