void setMaterial(const GLfloat mat_diffuse[4],GLfloat mat_shininess)
{
static const GLfloat mat_specular[]={0.0f,0.0f,0.0f,1.0f};
static const GLfloat mat_emission[]={0.0f,0.0f,0.0f,1.0f};
glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,mat_diffuse);
glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
glMaterialfv(GL_FRONT,GL_EMISSION,mat_emission);
glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess);
}
这个函数用来设置材质,然后最后一个函数出了问题error C2440: “glMaterialfv”: 无法从“GLfloat”转换为“const GLfloat *”,请问怎么解决呢?
解决思路:glMaterialfv(GL_FRONT,GL_SHININESS,&mat_shininess);