>>96077221
Thanks
>6
it's 12
Here's some code.
static float culRotation[16];
static int counter = 0;
void gMatrixRotation( GLuint Prog, GLfloat angle, GLfloat x, GLfloat y, GLfloat z){
float Temp[16];
if( counter == 0){
MLoadIdentity( culRotation);
MRotate( culRotation, angle, x, y, z);
}else if( counter > 0){
MLoadIdentity( Temp);
MRotate( Temp, angle, x, y, z);
MMultiply( culRotation, culRotation, Temp);
}
counter += 1;
}
void gPopMatrix(GLuint Prog, const char * uniform){
// push stuf to the shader program
glUniformMatrix4fv( glGetUniformLocation( Prog, uniform), 1, GL_FALSE, culRotation);
MLoadIdentity(culRotation);
counter = 0;
}
to replace this
MLoadIdentity(Rotation1);
MLoadIdentity(Rotation2);
MLoadIdentity(Rotation3);
MRotate( Rotation1, rot, 1.0f, 0.0f, 0.0f);
MRotate( Rotation2, rot, 0.0f, 1.0f, 0.0f);
MRotate( Rotation3, rot, 0.0f, 0.0f, 1.0f);
glUniformMatrix4fv( glGetUniformLocation( GLSL_Prog[0], "modelRotation"), 1, GL_FALSE, Rotation1);
glUniformMatrix4fv( glGetUniformLocation( GLSL_Prog[0], "modelRotation2"), 1, GL_FALSE, Rotation2);
glUniformMatrix4fv( glGetUniformLocation( GLSL_Prog[0], "modelRotation3"), 1, GL_FALSE, Rotation3);
into this.
gMatrixRotation( GLSL_Prog[0], rot, 0.0f, 0.0f, 1.0f);
gMatrixRotation( GLSL_Prog[0], rot, 0.0f, 1.0f, 0.0f);
gMatrixRotation( GLSL_Prog[0], rot, 1.0f, 0.0f, 0.0f);
gPopMatrix( GLSL_Prog[0], "modelRotation");