Dear friends…
I know that to set the translation matrix we can use the function glTranslatef() by passing to it the value of tx, ty and tz.
I have an assignment to set the translation matrix manually without using the glTranslate() function. What I am doing is this:
- Define that the matrix in use is the GL_MODEVIEW matrix.
- Load the identity matrix into this matrix.
- Declare this matrix:
float t1[16] = { 1.0, 0.0, 0.0, 175.0,
0.0, 1.0, 0.0, 125.0,
0.0, 0.0, 1.0, 100.0,
0.0, 0.0, 0.0, 1.0 }; - Use the glMultMatrix() function like this:
glMultiMatrix(t1); - The previous four steps must postmultiply the identity matrix with the t1
matrix which gives as a reslut the t1 matrix in the GL_MODEVIEW matrix. - Draw some shapes that must be translated according to the t1 matrix.
The problem here is the out drawing is not seems to be translated, actually I get a strange output.
Please can anyone help me with this.
Thanks in advance for your help…