Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7); in OpenGL ES 20?

How does the parameters work for it and exactly what is mProjMatrix getting from the method?

Also why is 'float mProjMatrix = new float[16];` declared with 16, could I have used another number instead?

    float mProjMatrix = new float[16];
    Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
like image 308
SeeYouSpaceCowboy Avatar asked Aug 09 '13 14:08

SeeYouSpaceCowboy


1 Answers

View frustum is just a visual representation of perspective projection that is used to convert 3D point in the world coordinate space to the 2D point on the screen.

There're multiple ways to define the projection matrix (at least that I used personally):

  1. By specifying 6 clip planes

  2. By specifying aspect ratio, far and near clipping planes, field of view angle

But in the end they all end up as a single 4x4 perspective transform matrix.

Here is a must read article.

like image 98
Max Avatar answered Sep 17 '22 18:09

Max