Gio*_*Gio 10 android opengl-es-2.0
我从android opengl es 2.0开始,我试图掌握这些概念.我写了下面的函数来旋转一个矩形.我通过使用方法rotateM中的值来成功进行一些旋转.但是我没有成功地对我的矩形进行一些具体的旋转,例如将2D向右旋转45度.
基本上我是在盯着android引用,其中说明了以下内容:
rotateM(float [] m,int mOffset,float a,float x,float y,float z)将矩阵m围绕轴(x,y,z)以角度a(以度为单位)旋转到位.
现在我明白我们提供了一个modelMatrix,这个矩阵的偏移和角度旋转,但为什么我们必须提供xyz轴组件,这些值真正做了什么?
希望有人能提前给我一个关于方法rotateM的明确解释,在此先感谢!
private void positionRectangleInScene() {
setIdentityM(modelMatrix, 0);
rotateM(
modelMatrix, // m : source matrix
0, // mOffset : index into m where the matrix starts
0f, // a : angle ato rotate in degrees
1f, // x : x-axis component
1f, // y : y-axis component
1f); // z : z-axis component
multiplyMM(
modelViewProjectionMatrix, 0,
viewProjectionMatrix, 0,
modelMatrix, 0);
}
Run Code Online (Sandbox Code Playgroud)
Pra*_*ndh 10
xyz值表示旋转轴.例如,围绕y轴的旋转将指定为(m,0,angle,0,1,0).您指定为(1,1,1)表示您将围绕所有3个轴旋转,而不是典型用法.
| 归档时间: |
|
| 查看次数: |
3383 次 |
| 最近记录: |