Home>

Someday I was told and I was caught in the search, so glMultMatrixf (const GLfloat * m);
I want to use, but it seems that 4 * 4 can be done

float e [16] = {cos (angle * M_PI/180) * px, 0 * py, sin (angle * M_PI/180) * pz, 0,
   0,1 * py, 0, 0,
  -sin (angle * M_PI/180) * px, 0 * py, cos (angle * M_PI/180) * pz, 0,
      0 * px, 0 * py, 0 * pz, 1};

qx = 0.003 * qx;
qy = 0.003 * qy;
qz = 0.003 * qz;
glNormal3f (MeshNormals [3 * b [0] +0], MeshNormals [3 * b [0] + 1], MeshNormals [3 * b [0] +2]);
glTexCoord2f (Texture [2 * c [0] +0], Texture [2 * c [0] + 1]);
glMultMatrixf (e);
glVertex3f (qx, qy, qz);

I'm not sure about glMultMatrixf (const GLfloat * m), so please tell me.

  • Answer # 1

    "glMultMatrixf"Please google" is the answer?
    (It seems that you need to pay attention to the order of the elements specified in the argument)


    Prior knowledge:
    OpenGL holds (?) Matrix groups in a global way, and operations are performed using them.
    Therefore, we need to set the matrix group to a value that produces the desired operation result.
    As a means, for example, update the contents of the matrix by the following procedure:

    glMatrixMode ()Select the matrix you are about to play with

    if neededglLoadIdentity ()Update to the identity matrix with

    glRotated ()ButgluPerspective ()If you use a prepared function such as
    Matrix contents = (current) matrix contents * Matrix calculated internally by the function
    The contents of the matrix are updated in the form of.

    … But, in step 3, if OpenGL doesn't provide a function that corresponds to what you want to do, that is,
    Matrix contents = (current) matrix contents * Matrix to multiply for update
    There is a case where you want to arbitrarily give a "matrix you want to multiply for updating", and the function for that isglMultMatrixf ()ButSame d ()That is the one.


    Functions of glMultMatrixf () (and d ()):
    As mentioned above, nowglMatrixMode ()The contents of the matrix are updated by multiplying the matrix selected in step by the matrix given by the argument.
    As mentioned above, the direction of multiplication isglRotated ()And so onHang from the right sideIt will be in shape.