Picking 3D objects with mouse give false positive

Started by
10 comments, last by Endurion 13 years, 1 month ago
I was using the WM_LBUTTONUP message to find the mouse coordinates.[/quote]
(Transform mouse coordinates from screen to client) now I'm doing it and the offset is really small[/quote]
If you're using the coordinates from LOWORD(lparam) and HIWORD(lparam) in your WM_LBUTTONUP case in the window procedure, they're already in client coordinates. Don't do any further conversion.

EDIT: shouldn't make a particular difference, but is there a reason you're using WM_LBUTTONUP rather than WM_LBUTTONDOWN?

EDIT2: see Endurion's post below. Failure to use AdjustWindowRect can cause very subtle problems. Good one!

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Advertisement
As Buckeye said.

There could also be a problem with the client area size. Does the back buffer size match the client area size? In other words, if you want to have a display size of say 800x600, do you use AdjustWindowRect(Ex) to calculate the real neeed window size?

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

This topic is closed to new replies.

Advertisement