颜色在照明中被洗掉了

时间:2013-11-22 03:18:34

标签: opengl colors lighting

enter image description here

我应该在中心有一枚金币,但是由于照明我的颜色会被洗掉,无论如何我可以避免它吗?

    glEnable(GL_LIGHTING);
GLfloat light[] = {1,1,1,1};
GLfloat light_position[] = {50,100,200,1};
glLightfv(GL_LIGHT0,GL_DIFFUSE,light);
glLightfv(GL_LIGHT0,GL_POSITION,light_position);
glEnable(GL_LIGHT0);

并绘制圆柱体         GLUquadricObj * qd = gluNewQuadric();     gluQuadricNormals(qd,GLU_SMOOTH);     gluQuadricTexture(qd,GL_TRUE);     gluQuadricDrawStyle(qd,GLU_FILL);     gluDisk(qd,0,1,20,20);

GLUquadricObj* q = gluNewQuadric();
gluQuadricNormals(q, GLU_SMOOTH);
gluQuadricTexture(q, GL_TRUE);
gluQuadricDrawStyle(q, GLU_FILL);
gluCylinder(q,1,1,1,20,20);

颜色是

        GLfloat c[4];
c[0] = m_kd.R();
c[1] = m_kd.G();
c[2] = m_kd.B();
c[3] = 1;
glMaterialfv(GL_FRONT, GL_DIFFUSE, c);

我也无法转动硬币(圆筒),否则我会把硬币的一部分变成黑色,有谁知道如何解决这个问题?

0 个答案:

没有答案