I am trying to detect when my left mouse button is released to store the result in a boolean variable in OpenGL GLUT. Currently, I am using the motion()
function in glutMotionFunc(motion);
and setting the boolean variable bool mouseIsHeldDown
to true when the left mouse button is held in motion to trigger an if statement in my render function myDisplay()
. However, I cannot find an efficient way to find when the left mouse button is released to declare the same variable as false.
Any ideas? Is there a way in Win32?
int main(int argc, char* argv[])
{
...
glutMotionFunc(motion);
...
}
void motion(int x, int y)
{
mouseIsHeldDown = true;
}
void myDisplay()
{
if (mouseIsHeldDown == true)
{
}
}