I know that isnt exist pushmatrix, popmatrix, and the matrix stack, loadidentity, rotate, translate etc.
How can I rewrite my existing 1.0-1.1 engine to work with 2.0?
I tried this first:
void glRotate(float x, float y, float z) {
Matrix.setRotateM(mMMatrix, 0, x, 1, 0, 0);
Matrix.setRotateM(mMMatrix, 0, y, 0, 1, 0);
Matrix.setRotateM(mMMatrix, 0, z, 0, 0, 1);
Matrix.multiplyMM(mMVPMatrix, 0, mVMatrix, 0, mMMatrix, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mMVPMatrix, 0);
}
void glTranslate(float x, float y, float z) {
Matrix.translateM(mMMatrix, 0, x, y, z);
Matrix.multiplyMM(mMVPMatrix, 0, mVMatrix, 0, mMMatrix, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mMVPMatrix, 0);
}
glTranslate it is not working, how can I translate my modell in the world?
glRotate only rotate in Z my object, x,y doesnt work at all.
+
How to implement a matrix stack/glpush/glpopmatrix? Anybody has a shema for that?
Try use
Matrix.setIdentityM(mMMatrix, 0);
before calculating matrix transformations.
And use Matrix.rotateM() instead of Matrix.setRotateM().