zydgyy

05-14-2012, 07:49 AM

here is from "http://www.opengl.org/sdk/docs/man/"

f=cotangent(

fovy

2

)

The generated matrix is

(

f

aspect

f

zFar+zNear

zNear−zFar

2×zFar×zNear

zNear−zFar

-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?

f=cotangent(

fovy

2

)

The generated matrix is

(

f

aspect

f

zFar+zNear

zNear−zFar

2×zFar×zNear

zNear−zFar

-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?