Easy Way To Translate Screen to Ortho/Viewport
Posted: Mon Aug 18, 2014 10:32 pm
I know how to do the math manually, but I am wondering if anyone knows an easy way to translate screen coordinates (mouse click X, Y) into a 2D glOrtho/Viewport with the matrices by grabbing them and performing a calculation.
I may answer my own question.
I could do it manually, but I am looking for an "elegant" solution.
For example:
[Yes, I'm matrix rusty. I bet a year ago I would have solved this one in 10 seconds flat. ]
I may answer my own question.
I could do it manually, but I am looking for an "elegant" solution.
For example:
If I manually calculate it, I'm only solving this instance of the issue. Should be a way to elegantly translate into or translate out of the viewport.mouse click at 64, 180 in client window
Where does it hit a viewport from (100,100)-(700,500) scaled with glOrtho to have coordinates of (0,0) through (320,200)
[Yes, I'm matrix rusty. I bet a year ago I would have solved this one in 10 seconds flat. ]