Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: about perspective projection matrix

  1. #1
    Intern Contributor
    Join Date
    Nov 2011
    Posts
    52

    about perspective projection matrix

    here is from "http://www.opengl.org/sdk/docs/man/"
    f=cotangent(
    fovy
    2
    )
    The generated matrix is
    (
    f
    aspect
    f
    zFar+zNear
    zNearzFar
    zFar×zNear
    zNearzFar
    -1
    )
    and here is my matrix in question:
    const float w = d_area.getWidth();
    const float h = d_area.getHeight();
    const float aspect = w / h;
    const float midx = w * 0.5f;
    d_viewDistance = midx / (aspect * 0.267949192431123f);
    const float nearZ = d_viewDistance * 0.5f;
    const float farZ = d_viewDistance * 2.0f;
    const float nr_sub_far = nearZ - farZ;
    float tmp[4][4];
    tmp[0][0] = 3.732050808f / aspect;
    tmp[0][3] = -d_viewDistance;
    tmp[1][1] = -3.732050808f;
    tmp[1][3] = d_viewDistance;
    tmp[2][2] = -((farZ + nearZ) / nr_sub_far);
    tmp[3][2] = 1.0f;
    tmp[3][3] = d_viewDistance;
    So what does this matrix represent,orth,perspertive?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135
    Does an orthographic projection involve a field of view? You should find the answer in 3, 2, 1 ...

  3. #3
    Intern Contributor
    Join Date
    Nov 2011
    Posts
    52
    Yes,there is no fovy,but i can't understand the matrix usage?!

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135
    What exactly? Why we use matrices in the first place? How the matrices are derived? What a matrix is anyway?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •