コード例 #1
0
ファイル: example.cpp プロジェクト: yuduosheng/OpenGL_common
/// Mouse move function
void mousemove(int x, int y) {

	if (buttonpressed == GLUT_MIDDLE_BUTTON) { // rotations handler
		AMatrix<float> mT;
		arcball.drag(x, winh - y, &mT);
		sceneT = mT*sceneIniT;
	}
	else if (buttonpressed == GLUT_RIGHT_BUTTON) { // translations handler
		double xw, yw, zw;
		screenToWorld(x, winh - y, xw, yw, zw);
		AMatrix<float> mT;
		mT.identity();
		mT.translation(xw - xwini, yw - ywini, zw - zwini);
		sceneT = mT*sceneIniT;
	}
	else if (buttonpressed == GLUT_LEFT_BUTTON) {
		Point2 p(x, winh - y);
		stroke.push_back(p);
	}
	glutPostRedisplay();
}