# getMousePos in GLFW

## Recommended Posts

Hey, I'm having a bit of problem in my programming. I'd like to get the mouseposition after clicking, so I use the function glfwgetMousePos (int *xpos, int *ypos) in GLFW. Also, i assign xpos = 0 in the beginning, and this is the answer i get wherever i click. How am i supposed to use this function correctly, so that xpos and ypos gets the current location? All help appreciated!

##### Share on other sites
static GLuint x_pos(0), y_pos(0) ;glfwGetMousePos( &x_pos, &y_pos ) ;// variable 'x_pos' and 'y_pos' should hold the last known coordinates// for the mouse position. There is another function in GLFW// that determines whether or not a button has been clicked.// Use that in conjunction from the above example to get// the last mouse clicking position.

~Khaosifix

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628314
• Total Posts
2982023

• 9
• 9
• 13
• 11
• 14