PDA

View Full Version : Rotating and gluUnProject



snapboy77
01-29-2002, 09:39 AM
I"m trying to add layer of detail to a globe. As you zoom in you'll see different maps depending on the x, y z coordinates of the sphere that map to the lower left and upper right corners of the screen. I"m able to get the coordinates off of the sphere correctly if I just zoom in. However if I do a rotatation (along x or z shpere axis) my gluUnProject gives me the same exact points as before the rotation. Then from that point on everything is messed up. I've tried doing an "unrotation" of the old points but I majorly messed up the math and I konw there's a way to do it inside of opengl (better to do it right) Any suggestions?
(NOTE: I'm brand new to opengl so please take it easy on me with the opengl speak and don't hesitate to over explain yourself. Thanks.)
Snapboy77

Bob
01-29-2002, 10:12 AM
If you get the same result after a rotation as before, it's probably because you get the modelview matrix too early. I guess you grab the modelview matrix before the rotation, instead of after. The glu(Un)Project functions can be a little bit tricky. You have to get the matrices in the right place.

snapboy77
01-31-2002, 05:47 AM
Thanks Bob that worked!