1. 程式人生 > >OpenGL ES (11): 答疑解惑 -- 矩陣乘法Matrix.multiplyMM();

OpenGL ES (11): 答疑解惑 -- 矩陣乘法Matrix.multiplyMM();

1.介紹

之前的文章中有將投影矩陣和相機檢視變換矩陣結合的一個方法,生成一個新的矩陣mMVPMatrix。

  • Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mViewMatrix, 0);

看官方文件:

public static void multiplyMM (float[] result, int resultOffset, float[] lhs, int lhsOffset, float[] rhs, int rhsOffset)

Multiplies two 4x4 matrices together and stores the result in a third 4x4 matrix. In matrix notation: result = lhs x rhs.

將兩個4x4矩陣相乘,並將結果儲存在第三個4x4矩陣中。以矩陣表示法表示:結果=lhs x rhs。

Parameters

result The float array that holds the result. 儲存結果的浮點數陣列。
resultOffset The offset into the result array where the result is stored.
lhs The float array that holds the left-hand-side matrix. 儲存左側矩陣的浮點數陣列。
lhsOffset The offset into the lhs array where the lhs is stored
rhs The float array that holds the right-hand-side matrix. 包含右側矩陣的浮點數陣列
rhsOffset The offset into the rhs array where the rhs is stored.