Advertisement

Mouse coords

Started by January 03, 2001 11:47 AM
-1 comments, last by RedKnite 23 years, 10 months ago
Im trying to get a 3d point from the 2d mouse coord passed through windows. It seems to be working, except the retrieved mouse coords seem to be rather high. Such as -89, 41, -94. This doesnt seem to correct when im clicking on an object thats no more then 1x1 unit. I use this. float y; float winz; GLdouble wx, wy, wz; GLdouble wx2, wy2, wz2; y = vp[3] - MPos.y; gluUnProject((GLdouble)MPos.x, (GLdouble)y, (GLdouble)0.0, mv, pro, vp, &wx, &wy, &wz); gluUnProject((GLdouble)MPos.x, (GLdouble)y, (GLdouble)1.0, mv, pro, vp, &wx2, &wy2, &wz2); CVector nearp = CVector(wx, wy, wz); CVector farp = CVector(wx2, wy2, wz2); CVector ray = nearp - farp; It just doesnt seem that these values are correct. Any ideas? thanks. ~ Chris

This topic is closed to new replies.

Advertisement