Cesar Ghali

05-06-2008, 07:17 AM

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:

1. Define that the matrix in use is the GL_MODEVIEW matrix.

2. Load the identity matrix into this matrix.

3. 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 };

4. Use the glMultMatrix() function like this:

glMultiMatrix(t1);

5. 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.

6. 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...

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:

1. Define that the matrix in use is the GL_MODEVIEW matrix.

2. Load the identity matrix into this matrix.

3. 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 };

4. Use the glMultMatrix() function like this:

glMultiMatrix(t1);

5. 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.

6. 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...