gpt4 book ai didi

c++ - GLUPerspective 的原始 OpenGL 等价物?

转载 作者:太空狗 更新时间:2023-10-29 23:42:39 25 4
gpt4 key购买 nike

如果没有 Glu,我怎么能像 GluPerspective 一样呢?谢谢

例如: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 );
}

关于c++ - GLUPerspective 的原始 OpenGL 等价物?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3058552/

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