glutWarpPointer会多次调用glutpassivemotionfuncc回调
glutWarpPointer makes multiple calls to the glutPassiveMotionFunc call back
我正在实现一个FPS风格的鼠标在我的场景中"飞行"。
我有正确的相机旋转和一切,我唯一的问题是,当我试图扭曲鼠标到屏幕的中间,它执行多个调用glutpassivemotionfunction回调。所以不是瞬间移动鼠标,而是通过几个动作将它移动到那里。这些移动经过处理,并将相机移回原始位置。
如何检查鼠标是否实际移动,而不是由glutWarpPointer函数触发
如果指针在屏幕中间,我试图不处理移动,但这没有帮助。
我想让我的程序在Linux和Windows上运行,这样我就不能使用操作系统的特定功能。
我不认为这是一个伟大的解决方案,但它应该工作:
bool isWarpingPointer = false;
void MyPassiveMovementCallback()
{
if (isWarpingPointer)
{
return;
}
//proceed normally
}
//elsewhere
isWarpingPointer = true;
glutWarpPointer();
isWarpingPointer = false;
相关文章:
- 没有找到相关文章