Opengl es 不确定如何在opengl es 2中旋转对象

Opengl es 不确定如何在opengl es 2中旋转对象,opengl-es,opengl-es-2.0,Opengl Es,Opengl Es 2.0,我不确定如何旋转我的物体。目前我有一个四边形,我希望能够以45度的角度查看它,我已经设置了我的模型视图投影矩阵。我知道我应该在着色器中而不是在实际代码中执行此操作,稍后我将对此进行更改,但这里有一些代码 bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen); p_Matrix = PVRTMat4::PerspectiveFovRH(PVRT_PI / 6, (float) PVR

我不确定如何旋转我的物体。目前我有一个四边形,我希望能够以45度的角度查看它,我已经设置了我的模型视图投影矩阵。我知道我应该在着色器中而不是在实际代码中执行此操作,稍后我将对此进行更改,但这里有一些代码

    bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen);
p_Matrix = PVRTMat4::PerspectiveFovRH(PVRT_PI / 6, (float) PVRShellGet(prefWidth) / (float) PVRShellGet(prefHeight), 4.0f, 1000.0f, PVRTMat4::OGL, bRotate);
PVRTVec3 view_From(2, 2, 0);
v_Matrix = PVRTMat4::LookAtRH(view_From, view_At, view_Up) * PVRTMat4::RotationX(45);
cam_Pos = view_From;

PVRTMat4 modelView, world, mMVP;
world = PVRTMat4::Identity();
modelView = v_Matrix * world;
mMVP = p_Matrix * modelView;

if(PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen)) // If the screen is rotated
    mMVP = PVRTMat4::RotationZ(-1.57f);

/*
    Pass this matrix to the shader.
    The .m field of a PVRTMat4 contains the array of float used to
    communicate with OpenGL ES.
*/
glUniformMatrix4fv(m_ShaderProgram.auiLoc[eMVPMatrix], 1, GL_FALSE, mMVP.ptr());

我已尝试旋转mMVP矩阵,但没有效果。并尝试旋转模型视图和v_矩阵(视图矩阵)。我使用了SDK提供的函数PVRTMat4::RotationX(45)

您可以使用PVRTMat4::scale(fx,fy,fz)函数获得所需旋转的44矩阵。设置fx=45、fy=0和fz=0。然后将返回到mMVP矩阵的矩阵相乘