I'm beginning in OpenGL ES on Android (Java); I'm following this tutorial : http://developer.android.com/training/graphics/opengl/projection.html
Things basically go well, except that I have some trouble with matrix-multiplication that I didn't have on desktop OpenGL (where I used GLM instead of java/android framework) My projection+view matrix does'nt work correctly when I do projection * view * vec4(..coords..) The only way for my geometry to be shown is to multiply by right : vec4(...) * MVP, where MVP is Projection*View. It shouldn't work (as far as I'm concerned) but... it does. At least a little bit. I get massive clipping problems by using this way, but it's still better than nothing :D
My problem is kinda similar to this (and same tutorial, but it looks like it got updated) : Android OpenGL weirdness with the setLookAtM method
But it looks like I have the opposite problem now. And I've tried every combination I've imagined to solve this (transpose MVP in GLSL, multiply view by projection and not the other way around, etc.)
Here's my code
//GLSL :
gl_Position = vec4(vPosition, 1.0) * MVP;
Where MVP is mMVPMatrix, which is defined as ...
Matrix.setLookAtM(mCameraMatrix, 0, 8, 8, -8, 0f, 0f, 0f, 0.0f, 1.0f, 0.0f);
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mCameraMatrix, 0);
And projection is
float ratio = (float) width / height;
android.opengl.Matrix.frustumM(mProjectionMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
Any idea ?