Focusing by mouse wheel rotate on 3.x

q66680 wrote on Wednesday, August 28, 2013:

hi.How to assign mouse wheell scroll up/down to

zoom in/zoom out on 3.x? I need an example about

glfwSetScrollCallback() to learn How to use?

Thanks.

q66680 wrote on Thursday, August 29, 2013:

i added this lines in my code.

void scroll(GLFWwindow* window,double x,double y){
std::cout<<x<<’\n’;
}
glfwSetScrollCallback(window,scroll);

Then i build the code and run without any error.Then i began to play mouse scroll. (a logitech’s scroll with 4 functions its accept push right/left)

when i scroll up/down its write to console “0” push right write “1” push left

write “-1” and not write anything else.Also i never get error.

What is mean these number? How to i use this about zoom event?

I am on linux-X11-mesa9.1(with GL 3.1) radeon HD 5450(desktop)
and use “forward-compatible”

EDIT:Because, i request to print only x-axis scroll above code that correspond by push left/right.

q66680 wrote on Thursday, August 29, 2013:

OK.i found a way! -1= multiply it a scalar and use for zoom out

1= multiply it a scalar and use for zoom in. Or vice versa.

dougbinks wrote on Thursday, August 29, 2013:

I’ve not used this functionality, but from the docs it looks like you should use the y value for scroll up/down, as the x value is scroll left/right.

q66680 wrote on Thursday, August 29, 2013:

yes.i saw.escape my eyes.