Rotation matrix issues


I am working with OpenGL ES 2.0 and ARToolKitPlus. From the ARTK+ I get a transformation matrix to rotate and scale the openGL model into the coordinates of the marker.

The problem is that, for some unknown reason, the rotations are inverted. So, the object rotate clockwise around the X axis while it was supposed to rotate counter clockwise. So, I should invert the matrix, but I do not know how to do it.

The other option is to calculate the transformation myself. To do so, I should calculate a 3D transformation for the openGL model from the 2D coordinates (coordinates on the screen) I get from the marker. I know the size of the marker, its 4 vertex and the center.

Anyone can help me in any of both solutions?

Thanks in advance!!

If it’s rotating the opposite direction of what you expect, why don’t you just invert the degree of rotation you’re using to build the transformation?

Yeah, my explanation wasn’t really good. In ARToolKitPlus you get the matrix calculated. So, it returns a 3x3 matrix which corresponds to the rotation on X, Y and Z and the scaling. So, I would like to invert the rotation from the matrix


This should help you in all your future matrix issues:
Matrix and Quaternion faq

Thanks for the answers. I have checked the Matrix faq but I haven’t solved my problem. The library gives me the following matrix:

-0.994377, 0.0460603, 0.0953538, 0,
-0.0229929, 0.785057, -0.618996, 0,
-0.103369, -0.617708, -0.779584, 0,
0, 0, 0, 1

So, to invert the rotation, I make the transpose, which is:

-0.994377, -0.0229929, -0.103369, 0,
0.0460603, 0.785057, -0.617708, 0,
0.0953538, -0.618996, -0.779584, 0,
0, 0, 0, 1

However, the result is exactly the same. It looks as if it was the same rotation. Am I doing something wrong?

Thanks again!