我是一个openGl的初学者。我正在做非常基础的事情。只想将一个物体绕x轴旋转20.0度。但是它不是旋转而是向上移动。
有人能帮我看看我做错了什么吗?
以下是我的代码:
void drawScene(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0f, 0.0f, 0.0f);
glPushMatrix();
//glTranslatef(1.0f,0.0f,0.0f);
glRotatef(20.0f,1.0f,0.0f,0.0f);
glBegin(GL_QUADS);
glVertex3f(-0.7f, -0.5f, -5.0f);
glVertex3f(0.7f, -0.5f, -5.0f);
glVertex3f(0.4f, 0.5f, -5.0f);
glVertex3f(-0.4f, 0.5f, -5.0f);
glEnd();
glPopMatrix();
glutSwapBuffers();
}