Function glFrustum

  • glFrustum describes a perspective matrix that produces a perspective projection. The current matrix (see glMatrixMode) is multiplied by this matrix and the result replaces the current matrix, as if glMultMatrix were called with the following matrix as its argument:

    ⎡ㅤ2 nearVal / right − leftㅤㅤㅤㅤㅤㅤㅤㅤㅤ0ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ𝐀ㅤㅤㅤㅤ0ㅤ⎤

    ⎢ㅤㅤㅤㅤㅤㅤㅤ0ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ2 nearVal / right − leftㅤㅤㅤ𝐁ㅤㅤㅤㅤ0ㅤ⎥

    ⎢ㅤㅤㅤㅤㅤㅤㅤ0ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ0ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ𝐂ㅤㅤㅤㅤ𝐃ㅤ⎥

    ⎣ㅤㅤㅤㅤㅤㅤㅤ0ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ0ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ−1ㅤㅤㅤㅤ0ㅤ⎦

    𝐀 = right + left / right - left

    𝐁 = top + bottom / top - bottom

    𝐂 = −(farVal + nearVal) / farVal - nearVal

    𝐃 = −2 farVal × nearVal / farVal - nearVal

    Typically, the matrix mode is GL_PROJECTION, and (left, bottom, −nearVal) and (right, top, −nearVal) specify the points on the near clipping plane that are mapped to the lower left and upper right corners of the window, assuming that the eye is located at (0, 0, 0). −farVal specifies the location of the far clipping plane. Both nearVal and farVal must be positive.

    Use glPushMatrix and glPopMatrix to save and restore the current matrix stack.

    Parameters

    • left: number

      Specifies the coordinate for the left vertical clipping plane.

    • right: number

      Specifies the coordinate for the right vertical clipping plane.

    • bottom: number

      Specifies the coordinate for the bottom horizontal clipping plane.

    • top: number

      Specifies the coordinate for the top horizontal clipping plane.

    • nearVal: number

      Specifies the distance to the near depth clipping plane. Must be positive.

    • farVal: number

      Specifies the distance to the far depth clipping plane. Must be positive.

    Returns void

    Summary

    multiply the current matrix by a perspective matrix

    Tutorial

    Songho - OpenGL Matrix Class (C++)

    See

    glFrustum

Generated using TypeDoc