我希望把一些照明進入一個項目,我創建的,但我得到以下編譯器錯誤:如何初始化一個GLfloat數組?
error C2440: 'initializing' : cannot convert from 'float' to 'GLfloat []'
問題是什麼?
GLfloat ambientColor[] = {0.2f, 0.2f, 0.2f, 1.0f};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientColor);
GLfloat lightColor0[] = (0.5f, 0.5f, 0.5f, 1.0f);
GLfloat lightPos0[] = (4.0f, 0.0f, 8.0f, 1.0f);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor0);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightPos0);
GLfloat lightColor1[] = (0.5f, 0.2f, 0.2f, 1.0f);
GLfloat lightPos1[] = (-1.0f, 0.5f, 0.5f, 0.0f);
glLightfv(GL_LIGHT1, GL_DIFFUSE, lightColor1);
glLightfv(GL_LIGHT1, GL_DIFFUSE, lightPos1);
+1提的逗號操作符 – pmg 2011-03-22 11:03:15