小编Fot*_*tis的帖子

Opengl 鼠标相机问题 (gluLookAt)

您好,我的鼠标在 openGL 中移动时遇到了一个奇怪的问题。这是我用鼠标移动相机的代码

void camera(int x, int y)
{
    GLfloat xoff = x- lastX;
    GLfloat yoff = lastY - y; // Reversed since y-coordinates range from bottom to top
    lastX = x;
    lastY = y;

    GLfloat sensitivity = 0.5f;
    xoff *= sensitivity;
    yoff *= sensitivity;

    yaw += xoff;                // yaw is x
    pitch += yoff;              // pitch is y

    // Limit up and down camera movement to 90 degrees
    if (pitch > 89.0)
        pitch = 89.0;
    if (pitch < -89.0) …
Run Code Online (Sandbox Code Playgroud)

c++ opengl camera mousemove glulookat

2
推荐指数
1
解决办法
1183
查看次数

标签 统计

c++ ×1

camera ×1

glulookat ×1

mousemove ×1

opengl ×1