I'm writing a function to create a perspective projection matrix and I'm getting some errors. Can you help me? I've marked the lines with error with '-'
typedef GLfloat mat4x4[16];
function:
void perspective(float fovy, float aspect, float near, float far, mat4x4& mat)
{
for(int i=0;i<16;i++)
mat[i]=0;
-float range = tan(degreesToRadians(fovy)/2.0f) * near;
float left = range * aspect;
float right = range * aspect;
float bottom = range;
float top = range;
-mat[0] = (2.0f * near) / (right - left);
-mat[5] = (2.0f * near) / (top - bottom);
--mat[10] = (far + near) / (far - near);
-mat[11] = 1.0f;
-mat[14] = (2.0f * far * near) / (far - near);
}
errors:
In function 'void perspective(float, float, float, float, GLfloat (&)[16])':
błąd:expected primary-expression before ';' token
błąd:expected primary-expression before ')' token
błąd:expected primary-expression before ')' token
błąd:expected primary-expression before ')' token
błąd:expected primary-expression before ')' token
błąd:expected primary-expression before ')' token
błąd:expected primary-expression before ')' token