我试图改变多边形的材质但它不起作用,我不知道为什么,
多边形不受 GL_AMBIENT、GL_DIFFUSE、GL_SPECULAR 和 GL_SHININESS 的影响。
GLfloat mat_ambient[] = { 1, 0.5, 0, 1.0 };
GLfloat mat_diffuse[] = { 0.4, 0.2, 0, 1.0 };
GLfloat mat_specular[] = { 0.774597, 0.774597, 0.774597, 1.0 };
GLfloat mat_shine = 0.6;
glMaterialfv (GL_FRONT, GL_AMBIENT, mat_ambient);
glMaterialfv (GL_FRONT, GL_DIFFUSE, mat_diffuse);
glMaterialfv (GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialf (GL_FRONT, GL_SHININESS, mat_shine * 128);
glPushMatrix();
glTranslatef(axeX, axeY, 0);
glRotatef(angle, 0, 0, 1);
glBegin(GL_POLYGON);
glNormal3f(0,0,1);
glVertex3f (-0.25, 0.5, 1.0);
glVertex3f (-0.5, 0.25, 1.0);
glVertex3f (-0.5, -0.25, 1.0);
glVertex3f (-0.25, -0.5, 1.0);
glVertex3f (0.25, -0.5, 1.0);
glVertex3f (0.5, -0.25, 1.0);
glVertex3f (0.5, 0.25, 1.0);
glVertex3f (0.25, 0.5, 1.0);
glEnd();
glPopMatrix();