Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

If I rotate about the X, or Y axis there is no skewing however for a pure 2D game that does not help me. When I try to rotate about the Z axis however the quad I am rendering for the sprite starts to skew until it disappears at 90 degrees appearing again shortly after a slowly resuming a quad shape. As far as I can tell I have written the code correctly, it is as I have written it before on 2D projects and it worked there I am either missing something stupid or OpenGL ES 2.0 does something different then what I expect, some excerpts of code follow:

Projection/View:

Matrix.setLookAtM(ViewMatrix, 0, 0, 0, 3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.orthoM(ProjectMatrix, 0, -width/2, width/2, -height/2, height/2, 0 , 100);   

Rotation/Scale/Translation(For in place set to identity first):

Matrix.translateM(Translation, 0, x, y, 1.0f);  
Matrix.setRotateM(Rotation, 0, angle += 0.05f, 0.0f, 0.0f, 1.0f);
Matrix.scaleM(Scale, 0, 64,64,1.0f);

Multiplication of Matrices:

Matrix.multiplyMM(MVPMatrix, 0, ProjectMatrix, 0, ViewMatrix, 0);
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Translation,0);
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Rotation, 0)
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Scale, 0);

Thanks for any help.

share|improve this question
    
Though I don't know too much of matrix transformations and stuff, I know you should pay attention to the order of translations/rotations. –  user717572 Mar 7 '12 at 21:47
    
The issue here was Matrix.multiplyMM, and using MVPMatrix as the output put and the input. In most all other libraries I used/made that would be correct. However looking closer at the specification for the function the api provided is undefined if any of the inputs or outputs overlap. –  leonmajere Mar 8 '12 at 1:10
    
@leonmajere What Matrix library are you using for android on java? Just a curiosity. –  Gustavo Maciel Mar 8 '12 at 1:42
    
android.opengl.Matrix developer.android.com/reference/android/opengl/Matrix.html –  leonmajere Mar 8 '12 at 4:32

1 Answer 1

up vote 1 down vote accepted

The issue here was Matrix.multiplyMM, and using MVPMatrix as the output put and the input. In most all other libraries I used/made that would be correct. However looking closer at the specification for the function the api provided is undefined if any of the inputs or outputs overlap

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.