Kal Mar
12-03-2010, 07:06 AM
Hi guys
I have a stupid problem but i don't resolve.
I like to translate an object according to passive movement of mouse, with callback glutPassiveMotionFunc.
At initialize I draw my objetc, at (0,0,0) position,
in mousemove function I trying:
void onMouseMove(int x, int y) {
dx = x - onMouse_prev_x;
dy = y - onMouse_prev_y;
onMouse_xtrans -= dx / 100;
onMouse_ytrans -= dy / 100;
glTranslated(onMouse_xtrans, onMouse_ytrans, 0.0);
drawCube();
}
when run a program, next a first movement (passive) of mouse o object the object disappears.
Thanks,
I have a stupid problem but i don't resolve.
I like to translate an object according to passive movement of mouse, with callback glutPassiveMotionFunc.
At initialize I draw my objetc, at (0,0,0) position,
in mousemove function I trying:
void onMouseMove(int x, int y) {
dx = x - onMouse_prev_x;
dy = y - onMouse_prev_y;
onMouse_xtrans -= dx / 100;
onMouse_ytrans -= dy / 100;
glTranslated(onMouse_xtrans, onMouse_ytrans, 0.0);
drawCube();
}
when run a program, next a first movement (passive) of mouse o object the object disappears.
Thanks,