really basic mouse related question


I am really a newbie, I know I can detect that a mouse is moved on window by using the mousemoved() function,

but now i also want to detect if a mouse rolls out of the window, i.e i want to set certain flag if the mouse is not over the GL window.


This can be supported (by using glutEntryFunc GLUT callback if you’re interested) but OF isn’t set up to use it right at the moment, unfortunately.

Hi joshuajnoble,

Thankyou for your answer. I tried using the above function, but the results were not as expected.

I tried to debug it but I found out the following comment on lighthouse3D

Note: This doesn’t work exactly as it says in Microsoft Windows, this is because in Microsoft’s OS the focus is changed with a mouse click. Although you can change this is your own system using some tools from Microsoft, others are likely to have the standard setting so its probably better if you don’t use this feature in Microsoft Windows to detect when the mouse enters/leaves the window.

can you suggest any other way.

Hmm. Well, OF is tied to GLUT so if that’s not working as expected I suspect the only other option is to hack ofAppGlutWindow::winProc() to add in the functionality described here or here

I don’t have a windows machine but it seems pretty straightforward.