Exemplo n.º 1
0
/**
 * Modified function found on the official OpenGL wiki.
 * http://www.opengl.org/wiki/GluPerspective_code
 * Used to replace gluPerspective (Fixed function deprecated?)
 */
void glhPerspectivef2(GLfloat *matrix, GLfloat fovyInDegrees, 
		GLfloat aspectRatio, GLfloat znear, GLfloat zfar)
{
    float ymax, xmax;
    //float temp, temp2, temp3, temp4;
    ymax = znear * tanf(fovyInDegrees * M_PI / 360.0);
    //ymin = -ymax;
    //xmin = -ymax * aspectRatio;
    xmax = ymax * aspectRatio;
    glhFrustumf2(matrix, -xmax, xmax, -ymax, ymax, znear, zfar);
}
Exemplo n.º 2
0
void glhPerspectivef2(
                      float *matrix,
                      float fovyInDegrees,
                      float aspectRatioV,
                      float znear,
                      float zfar
                     )
{
    float ymax, xmax;
    ymax = znear * tan(fovyInDegrees * M_PI / 360.0);
    //ymin = -ymax;
    //xmin = -ymax * aspectRatioV;
    xmax = ymax * aspectRatioV;
    glhFrustumf2(matrix, -xmax, xmax, -ymax, ymax, znear, zfar);
}