I have some functionality for the left mouse button and it works, but I wanted to have another functionality for the right button. It works, too, but when I try to include both of them, the functionality for the one of the buttons, stops. What am I missing?
void GLFWCALL onMouseRightButton( int button, int action ) {
if( button==GLFW_MOUSE_BUTTON_RIGHT )
{
// ... some code
}
}
void GLFWCALL onMouseMoveRight( int a, int b ) {
if( dragging_right )
{
// some math
}
}
Then after initialization, I have:
glfwSetMouseButtonCallback( onMouseButtonLeft );
glfwSetMousePosCallback( onMouseMoveLeft );
glfwSetMouseButtonCallback( onMouseButtonRight);
glfwSetMousePosCallback( onMouseMoveRight);
but in this form only the functionality for the right button works, and if I comment the last two functions – glfwSetMouseButtonCallback( onMouseButtonRight); and glfwSetMousePosCallback( onMouseMoveRight); everything with the left button is fine.
Could you please tell me how to make both of them work fine? Thank you very much in advance!
When you call the second
glfwSetMouseButtonCallbackyou are actually overwriting the last callback. YouronMouseButton[...]should be like this: