Detecting mouse location in viewport example


i am using viewports in a project. i want to detect my mouse location in reference to objects drawn in that viewport. in looking at the viewports example that comes with oF, i noticed that the 3d viewport can detect the mouseClick in its window. however, it is not programmed anywhere in the code. is the mouse functionality embedded within the camera .begin() or ofDrawGrid functions? (i don’t see the mouse referenced in the code for those function when i use "jump to definition"either.)



I believe you’re looking for something like this, look at the last post specially.


this is what i thought i needed to do. although, i am still curious to know how it’s working in the example since there is no mouseclicked/dragged code written.



Which example is it? It might be that the viewport is at 0,0 so no mapping is required

it’s an example in the OF distribution in 8.4>examples>gl>viewportExample

the poisiton of the viewport is randomixed, so the position changes every time the spacebar is pressed.

Oh! It’s ofEasyCam, it internally detects mouse position and uses its viewport ofRectangle