• Create Account

### #ActualMarusu

Posted 06 February 2012 - 02:27 AM

Hi, I am developing on android and I have encountered one problem. In opengl documentation it says, that matrices are in column-major order and translation matrix looks like this:
1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1
But in my program I use method like this:
public static final float[] translation(float x, float y, float z) {

// 4x4 translation matrix.

return new float[] {

1.0f, 0.0f, 0.0f, 0.0f,

0.0f, 1.0f, 0.0f, 0.0f,

0.0f, 0.0f, 1.0f, 0.0f,

x, y, z, 1.0f,

};

}

And it works until I try to change x, y, z position to last column.
Does this have to do with the fact that I use 1D array and not 2D? Does each row in this array represents a column when passed to opengl methods?

Thank you,
Martin

### #2Marusu

Posted 06 February 2012 - 02:27 AM

Hi, I am developing on android and I have encountered one problem. In opengl documentation it says, that matrices are in column-major order and translation matrix looks like this:
1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1
But in my program I use method like this:
public static final float[] translation(float x, float y, float z) {

// 4x4 translation matrix.

return new float[] {

1.0f, 0.0f, 0.0f, 0.0f,

0.0f, 1.0f, 0.0f, 0.0f,

0.0f, 0.0f, 1.0f, 0.0f,

x, y, z, 1.0f,

};

}

And it works until I try to change x, y, z position to last column, it stops working.
Does this have to do with the fact that I use 1D array and not 2D? Does each row in this array represents a column when passed to opengl methods?

Thank you,
Martin

### #1Marusu

Posted 06 February 2012 - 02:26 AM

Hi, I am developing on android and I have encountered one problem. In opengl documentation it says, that matrices are in column-major order and translation matrix looks like this:
1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1
But in my program I use method like this:
public static final float[] translation(float x, float y, float z) {

// 4x4 translation matrix.

return new float[] {

1.0f, 0.0f, 0.0f, 0.0f,

0.0f, 1.0f, 0.0f, 0.0f,

0.0f, 0.0f, 1.0f, 0.0f,

x, y, z, 1.0f,

};

}

And it works, if I try to change x, y, z position to last column, it stops working.
Does this have to do with the fact that I use 1D array and not 2D? Does each row in this array represents a column when passed to opengl methods?

Thank you,
Martin

PARTNERS