gpt4 book ai didi

c - 被动运动检测

转载 作者:行者123 更新时间:2023-11-30 15:53:40 25 4
gpt4 key购买 nike

如何使用 opengl 检测鼠标被动运动?换句话说,我如何知道它是否在向前、向后、向左、向右移动?

我已经做到了

glutPassiveMotionFunc ( func ) 

void func ( int x, int y ) {

// x and y always positive, I wait it should be negative if it goes left
// acc. to my coordinate system determined in glLookAt.
}

最佳答案

来自docs :

The x and y callback parameters indicate the mouse location in window relative coordinates.

如果您对光标如何在两帧之间移动(增量)感兴趣,请存储每帧的光标位置并计算“当前”位置和“上次看到”位置之间的差异。

关于c - 被动运动检测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13539800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com