PDA

View Full Version : Why gluUnProject returns incosistent Obj Coords?



stargazer
07-02-2005, 02:55 AM
I just wondering why if I change the orientation of the view for example:

From:

glTranslatef(0.0, 0.0, 0.0);
glScalef(1.0, 1.0, 1.0);
glRotatef(720, 1.0, 0.0, 0.0);
glRotatef(360, 0.0, 0.0, 1.0);

gluUnProject Coords: objx = -0.488667 objy = 0.025000 objz = -0.499775

When I do rotation, scaling & tranlation for ex:

glTranslatef(0.105000, -0.370000, 0.000000)
glScalef(1.100000, 1.100000, 1.100000)
glRotatef(697.000000, 1.0, 0.0, 0.0);
glRotatef(328.333344, 0.0, 0.0, 1.0);

gluUnProject Coords: objx = -0.338066 objy = -0.303501 objz = -0.625457

Does gluUnProject really behaves this way?

I just followed this article:

http://nehe.gamedev.net/data/articles/article.asp?article=13#2

Benjamin
07-03-2005, 06:26 PM
It just returns a current coords.

When you rotate the Obj ,all the coords of the obj have been change too.

but I know these are some ways to get back the init coords.

stargazer
07-03-2005, 11:45 PM
Do you know how to get back to INIT coords without changing the orientation of the view or redrawing the screen?

jide
07-04-2005, 09:07 AM
I haven't done any UnProject at all. But I think the best thing would be to get the invert of the matrices, then multiply the coordinates with the matrix.