Home > Software engineering >  OpenGL model
OpenGL model

Time:09-24

I want to be able to implement a model with rotation, the rotation and obtain certain coordinate point of the new distance, but, if you use glRotatef function, image rendering is rotating, but before the extraction and rotation are the coordinates of the same, could you tell me the coordinates are calculated separately, or is there a way to get directly, my display function code is as follows:
Void the display ()
{
GlClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

GlMatrixMode (GL_MODELVIEW);
GlLoadIdentity ();

//glTranslated (0.0, 0.0, 0.25);//gavab face information display
GlTranslated (0.0, 0.0, 3);
GlMultMatrixd (pModelViewMatrix);

GlColorMaterial (GL_FRONT GL_AMBIENT_AND_DIFFUSE);//set the color to track the material properties, and the face of the polygon
If (pModel)
{
GlColor3f (0.3, 0.3, 0.3);
GlRotatef (Angle, 0.0 f, f, 1.0 0.0 f);
Angle++;
GlmDraw (pModel GLM_FLAT);
}
GlutSwapBuffers ();
}

CodePudding user response:

Search online tutorial "learning OpenGL make up 3 d games"?

CodePudding user response:

Can be divided into the viewpoint of rotation and model posture change

The latter position change matrix is calculated by the yourself, glMultMatrixd (M) can change the position of the matrix, at the same time with this matrix multiplied by the target coordinates after the transformation

CodePudding user response:

refer to the second floor victor_woo response:
can be divided into the viewpoint of rotation and model posture change

The latter posture change matrix is calculated by yourself, glMultMatrixd (M) can change the position of the matrix, at the same time with this matrix is multiplied by the target coordinates transformation after

Upstairs said makes sense, see you is to change the camera position or change model?
  • Related