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

  • SEARCH
  • Home
  • 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 8118141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:23:23+00:00 2026-06-06T04:23:23+00:00

I have a program that gets the FOV angle of the device’s rear-facing camera,

  • 0

I have a program that gets the FOV angle of the device’s rear-facing camera, which returns the horizontal and vertical angle in degrees like so:

54.8
42.5

Is there an easy conversion to apply to get right “left, right, bottom, top” parameters to pass into OpenGL’s Matrix.frustrumM()?

Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);

I’m overlaying OpenGL shapes onto a CameraView and want to make sure they are drawn correctly relative to real world objects in the camera feed, for all devices regardless of the camera’s FOV.

Much thanks!


Edit: Here’s a solution, in case anyone comes across this:

private float[] perspectiveM(float fovY, float fovX, float zNear, float zFar)
{
    float[] projMatrix = new float[16];
    float aspect = fovX / fovY;
    fovY = (float) ((fovY /180.0) * Math.PI); // degrees to radians
    float g = (float) (1 / Math.tan(fovY / 2));

    for(int i=0; i<16; i++) {
        switch (i) {

        case 0:
            projMatrix[i] = g / aspect;
            break;
        case 5:
            projMatrix[i] = g;
            break;
        case 10:
            projMatrix[i] = (zFar + zNear)/(zNear - zFar);
            break;
        case 11:
            projMatrix[i] = -1.0f;
            break;
        case 14:
            projMatrix[i] = (2 * zFar * zNear)/(zNear - zFar);
            break;
        default:
            projMatrix[i] = 0.0f;
        }
    }

    return projMatrix;
}

Then assign the return result to your projection matrix.

  • 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-06T04:23:25+00:00Added an answer on June 6, 2026 at 4:23 am

    I didn’t realize that perspectiveM was limited to a certain API level, but you can easily recreate the function yourself. The formulas are on the man page for gluPerspective, which works the same way.

    You can just build the float matrix yourself using these equations:

    http://www.opengl.org/sdk/docs/man/xhtml/gluPerspective.xml

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that gets a JSON from the server using getJSON and
I have a Java program that is supplied a directory name, gets a list
I have made a Windows Service that gets installed in a c:\Program Files\My Service
I have an program that gets installed via an msi. The msi was built
I have a batch-file program that gets called from another batch-file so I can
I have a program in Python that gets a window handle via COM from
I have made a program that gets some strings in input from the user
I have a program that calls a rest service and gets back a string
I have a program that gets a KERN_PROTECTION_FAILURE with EXC_BAD_ACCESS in a very strange
I have a program that gets data from SQL server table. The code is

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.