The fourth chapter example: 112
The code for the fourth chapter: ModelViewProjection
Part of the code is as follows:
M3DMatrix44f mTranslate mRotate, mModelview mModelViewProjection;
//Create a translation matrix to move the torus back and into sight
M3dTranslationMatrix44 (mTranslate, 0.0 f, f, 0.0-2.5 f);
//Create a rotation matrix -based on the current value of yRot
//m3dDegToRad (yRot) for rotating arc
M3dRotationMatrix44 (mRotate m3dDegToRad (yRot), 0.0 f, f 1.0, 0.0 f);
//Add the rotation to the translation, and store the result in mModelView
//here it is after the first translation rotating
M3dMatrixMultiply44 (mTranslate, mRotate);
//Add the modelview matrix to the the projection matrix,
//the final matrix is the ModelViewProjection matrix.
//but here is what is after the first projection, model view changes, should not first model view change, after projection?????????????????????????
M3dMatrixMultiply44 (mModelViewProjection, viewFrustum. GetProjectionMatrix (), mModelview);
Run the program, normal, graphic move first, after the rotation, right after the projected onto the screen, after m3dMatrixMultiply44 function simply a matrix multiplication before a matrix, no judgment,
For several days, everybody help have a look
CodePudding user response:
http://www.cnblogs.com/graphics/archive/2012/08/02/2616017.htmlTake a look at this article, the main means of opengl matrix using column, when mat vector vec and matrix multiplication,
Directx: result=vec * mat;
Opengl: result=mat * vec;
LianCheng, near the vertex transformation to realize