Hi,
I've been trying to figure this (mouse picking and coordinates) out all night and I'm getting nothing but a headache... I haven't been able to find anything that directly does what I want here. It sounds like a stupid question, but my brain just doesn't seem to be working today...
The mouse coordinates are retrieved from top/left right? Can anyone tell me what formula would be best to convert this to start from the center of the screen (opengl style)? Everything I come up with has a flaw, but maybe I have to have a bunch of ifs to check for what quadrant the mouse is in and then do something different?
It's basically a mouse picking (screen to world coord) problem, but I have zero time to implement a big color checking, raycasting, etc, solution. For what I need it would seem like a simple formula (or multiple formulas) to transform top/left to center would suffice, at least for now as a hack until I have time later.
So, if I have an object at say (256, 90, 7) in opengl space, and I want to know when the mouse is near 256, 90, it seems like it would be a simple addition of half the width and height of the window, but that only works I think when its in that quadrant. Anyway, my overtired brain can't seem to piece it together... Normally I'd feel pretty emarassed to post what could just be a math stupidity on my part, but maybe someone else can give me a quick answer.
Longer term, I tried to use gluUnProject and such to get world coordinates, but it was always inaccurate in the results... I'm only using SFML::Window currently for window creation, so I don't think I can use the screen coord conversion in SFML::View.
I hope I didn't place this in the wrong category too. I apologize if this post sounds garbled or stupid, I haven't gotten much sleep in the last 48 hours.. Watch it be like some simple thing that I figure out right after posting
Though maybe someone can help me get proper screen-to-world actually working though, which it would be cool. Ok, thanks!