Javascript 视锥台的“顶部”是否视为近平面的顶部?

Javascript 视锥台的“顶部”是否视为近平面的顶部?,javascript,opengl,math,matrix,webgl,Javascript,Opengl,Math,Matrix,Webgl,在下面的函数中,视平截头体的顶部为近平面。这是真的吗?如果没有,顶部在哪里 /* * mat4.perspective * Generates a perspective projection matrix with the given bounds * * Params: * fovy - scalar, vertical field of view * aspect - scalar, aspect ratio. typically viewport width/height

在下面的函数中,视平截头体的顶部为近平面。这是真的吗?如果没有,顶部在哪里

/*
 * mat4.perspective
 * Generates a perspective projection matrix with the given bounds
 *
 * Params:
 * fovy - scalar, vertical field of view
 * aspect - scalar, aspect ratio. typically viewport width/height
 * near, far - scalar, near and far bounds of the frustum
 * dest - Optional, mat4 frustum matrix will be written into
 *
 * Returns:
 * dest if specified, a new mat4 otherwise
 */
mat4.perspective = function(fovy, aspect, near, far, dest) {
    var top = near*Math.tan(fovy*Math.PI / 360.0);
    var right = top*aspect;
    return mat4.frustum(-right, right, -top, top, near, far, dest);
};
Math.tanfovy*Math.PI/360.0;基本上是tanfovy/2,如果fovy是弧度而不是度,那么near*tanfovy/2给出了近平面上半部分的高度


这就是OpenGL中视图顶部平截头体的含义,还是仅限于这种情况?

当前版本的OpenGL在API中并没有真正的平截头体概念。只有生成剪辑坐标的顶点着色器。它们如何做到这一点,包括应用什么转换,完全取决于调用方。当然,使用定义为视锥体的投影矩阵仍然很常见

对于遗留OpenGL中的glFrustum调用,您的观察是绝对正确的。左侧、右侧、底部和顶部在近平面处测量。从:

通常,矩阵模式为GL_投影,左下-nearVal和右上-nearVal指定近剪裁平面上映射到窗口左下角和右上角[…]的点


谢谢这就是我在learningwebgl.com的第1课中注意到的。但是learningwebgl.com并没有解释矩阵是如何工作的。它只是向您展示了如何使用这些函数。我想知道是否有一套更好的课程/教程可以从头教你所有的理论。