易妖游戏网
您的当前位置:首页undefined reference to `gluPerspective‘ 解决方法

undefined reference to `gluPerspective‘ 解决方法

来源:易妖游戏网

由于高版本的Opengl移除了gluPerspective函数,故需要自行编写该函数。
这里是一个由Copilot自动补全的gluPerspective函数,亲测可用。

void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
{
    GLdouble xmin, xmax, ymin, ymax;

    ymax = zNear * tan(fovy * 3.14159265 / 360.0);
    ymin = -ymax;
    xmin = ymin * aspect;
    xmax = ymax * aspect;

    glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
}

因篇幅问题不能全部显示,请点此查看更多更全内容