In function _math_matrix_frustum you use incorrect macros in this place void _math_matrix_frustum( GLmatrix *mat, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearval, GLfloat farval ) { GLfloat x, y, a, b, c, d; GLfloat m[16]; x = (2.0F*nearval) / (right-left); y = (2.0F*nearval) / (top-bottom); a = (right+left) / (right-left); b = (top+bottom) / (top-bottom); c = -(farval+nearval) / ( farval-nearval); d = -(2.0F*farval*nearval) / (farval-nearval); /* error? */ <b>#define M(row,col) m[col*4+row]</b> M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; #undef M matrix_multf( mat, m, MAT_FLAG_PERSPECTIVE ); } If we want use element m[2][3], we must use m[2*4+3] where 2 - row and 3 - col, but not vice versa. Correct macros #define M(row,col) m[row*4+col] Sorry for my english.
OpenGL matrices are stored in column-major order. The macros are correct. The glFrustum function has been working properly for many years.
Sorry I did not know it. Thank you for your answer.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.