GLUP的原始OpenGL等价物?

jma*_*erx 2 c c++ opengl

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

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

Sur*_*ine 7

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 );
}
Run Code Online (Sandbox Code Playgroud)