I wonder if anyone can help me learn how to correctly use glMultMatrix.
I have the following render code in my app, however it appears I cannot just feed a C struct with the matrix to glMultMatrix :
-(void)render
{
matrixStruct matrices[] = {1, 0, -0, -9.37988, 0, -0.651537, 0.758617, 1133.64, 0, 0.758617, 0.651537, 129730, 0, 0, 0, 1};
// clear the matrix
glPushMatrix();
glLoadIdentity();
//scale
glScalef(0.00001, 0.00001, 0.00001);
glMultMatrixf(matrices);
[mesh render];
//restore the matrix
glPopMatrix();
}
I understand from the documentation at http://www.opengl.org/sdk/docs/man/xhtml/glMultMatrix.xml that I need to provide :
void glMultMatrixd( const GLdouble * m);
void glMultMatrixf( const GLfloat * m);
m
Points to 16 consecutive values that are used as the elements of a 4 × 4 column-major matrix.
I am not sure how I should format my matrix and pass it to glMultMatrix. Also do I need to enable glMatrixMode before I call render ?
Thank you
Worked it out – I needed to pass an array of floats :
e.g
float matrices[] ={1,0,0,0,0,1,0,0,0,0,1,0,-578.556,7068.92,48.6953,1};
All working now – thanks.