0
오브젝트를 회전하는 방법이 확실하지 않습니다. 현재 쿼드가 있으며 45도 각도로 볼 수 있기를 원하며 모델 뷰 투영 행렬을 설정했습니다. 실제 코드 대신 쉐이더에서이 작업을 수행해야한다는 것을 알고 있습니다. 나중에 변경 하겠지만, 여기에 몇 가지 코드가 있습니다.OpenGL에서 오브젝트를 회전하는 방법을 잘 모르겠습니다.
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 매트릭스를 회전 시키려고했지만 효과가 없습니다. 또한 modelview 및 v_matrix (뷰 매트릭스)를 회전하려고 시도했습니다. PVRTMat4 :: RotationX (45)라는 SDK에서 제공하는 함수를 사용했습니다.