OpenGL uses the right-hand coordinate system and d3d uses the left-hand coordinate system. The four fingers of the hand are directed to the palm of the hand, and the thumb points to the Z axis. Therefore, during coordinate transformation, OpenGL rotates counter-clockwise, while direct 3D rotates clockwise. (Point of origin along the axis)
The method of judgment is to give your thumb to yourself and hold your hand in four fingers.
In d3d, the right multiplication matrix is used to change the sitting mark. Therefore, the order of matrix concatenation is from left to right.
D3dxmatrixmultiply (& matworld, & matrotation, & mattranslation); // rotate first, then translate
M_pdevice-> settransform (d3dts_world, & matworld );
Glmatrixmode (gl_modelview );
Glloadidentity ();
Glmultmatrixf (n);/* apply transformation N */
Glmultmatrixf (m);/* apply transformation m */
Glmultmatrixf (l);/* apply transformation L */
Glbegin (gl_points );
Glvertex3f (V);/* draw transformed vertex v */
Glend ();
In OpenGL, with this code, the modelview matrix successively contains I, n, nm, and finally NML, where I
Represents the identity matrix. The transformed vertex is nmlv. Thus, the vertex transformation is
N (m (LV)-that is, V is multiplied first by L, the resulting LV is multiplied by m, and the resulting mlv
Is multiplied by N. notice that the transformations to vertex v divide tively occur in the opposite order
They were specified. (actually, only a single multiplication of a vertex by the modelview matrix occurs;
In this example, the n, m, and l matrices are already multiplied into a single matrix before it's applied to v.