template <typename type> inline mat4<type> mat4<type>::perspectiveProjection(type fovy, type aspect, type zNear, type zFar) { type f = (type) 1 / tan(radians(fovy) / 2); return mat4<type>(f / aspect, 0, 0, 0, 0, f, 0, 0, 0, 0, (zFar + zNear) / (zNear - zFar), (2*zFar*zNear) / (zNear - zFar), 0, 0, -1, 0); } template <typename type> inline mat4<type> mat4<type>::orthoProjection(type xRight, type xLeft, type yTop, type yBottom, type zNear, type zFar) { type tx, ty, tz; tx = - (xRight + xLeft) / (xRight - xLeft); ty = - (yTop + yBottom) / (yTop - yBottom); tz = - (zFar + zNear) / (zFar - zNear); return mat4<type>(2 / (xRight - xLeft), 0, 0, tx, 0, 2 / (yTop - yBottom), 0, ty, 0, 0, -2 / (zFar - zNear), tz, 0, 0, 0, 1); }
OpenGL4.x不支持gluPerspective函数。故备份之,布布扣,bubuko.com
OpenGL4.x不支持gluPerspective函数。故备份之
原文:http://www.cnblogs.com/nmgxbc/p/3585315.html