GLUPerspective的原始OpenGL等价物? [英] Raw OpenGL equivillant of GLUPerspective?

查看:145
本文介绍了GLUPerspective的原始OpenGL等价物?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何做同样GluPerspective没有Glu?感谢

how could I do the same as GluPerspective without Glu? Thanks

ex:gluPerspective(45.0,(float)w /(float)h,1.0,200.0);

ex: gluPerspective(45.0, (float)w / (float)h, 1.0, 200.0);

推荐答案

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

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

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

这篇关于GLUPerspective的原始OpenGL等价物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆