Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7996951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:50:28+00:00 2026-06-04T14:50:28+00:00

I have a perspective FOV, but when rotating, it doesn’t look correct – Farther

  • 0

I have a perspective FOV, but when rotating, it doesn’t “look” correct – Farther objects traverse faster than closer objects, passing them in the middle of the screen.

So: Is this correct? Using right-handed coordinates, if that matters?

    public static Matrix4x4 PerspectiveFOV(float fov, float aspect, float near, float far)
    {
        float yScale = 1.0F / (float)Math.Tan(fov / 2);
        float xScale = yScale / aspect;
        float farmnear = far - near;
        return new Matrix4x4(
            xScale, 0, 0, 0,
            0, yScale, 0, 0,
            0, 0, far / (farmnear), 1,
            0, 0, -near * (far / (farmnear)), 1
            );
    }

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:50:30+00:00Added an answer on June 4, 2026 at 2:50 pm

    I see a couple of problems.
    First, the argument to tan() should be converted from degrees to radians.

    Second, the formula for perspective projection in OpenGL is a little different from yours. As specified here, it uses ‘near – far’ in the denominator instead of your ‘far – near’. The numerator terms are also different. Modifying your function slightly and converting from Java to C, I produced a projection matrix identical to the one given by gluPerspective() with the following:

    static void my_PerspectiveFOV(double fov, double aspect, double near, double far, double* mret) {
        double D2R = M_PI / 180.0;
        double yScale = 1.0 / tan(D2R * fov / 2);
        double xScale = yScale / aspect;
        double nearmfar = near - far;
        double m[] = {
            xScale, 0, 0, 0,
            0, yScale, 0, 0,
            0, 0, (far + near) / nearmfar, -1,
            0, 0, 2*far*near / nearmfar, 0 
        };
        geom_matrix4_copy(m, mret);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed PDT 2.1 but i can't switch to the PHP Perspective, any
Is it possible to have a read-only setting (from the user's perspective, but read/write
i have one perspective and one viewpart. The viewpart is shown as soon as
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css
have not tested on windows. but in ubuntu when u disconnect from the network,
I have a perspective in an RCP product defined as following: IFolderLayout bottomLeft =
I have been reading about bcrypt (application perspective). Thinking of using it to store
I have a CALayer that I apply a perspective to using a CGTransform3D and
i have problems simulating call or sms since telnet or ddms perspective on eclipse.
I'm currently using twisted's perspective broker on python and I have considered in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.