I get my mouse coordinates like this:
winX = QCursor::pos().x();
These are coordinates for the whole screen. I need to get coordinates that are relative to my OpenGL widget window’s viewport, so I can use the gluUnProject function.
How can I do that?
You might want to have a look at QWidget’s
mapFromGlobal(const QPoint & pos)method.As per the documentation this: