hello everyone,
when I draw a solidsphere at (1,0,0) and shading it as below
GLfloat lightIntensity[]={0.7f, 0.7f, 0.7f, 1.0f};
GLfloat light_position[]={0.1, 0, 0.0f, 0.0f};
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightIntensity);
…
glPushMatrix();
glTranslated(1,0, 0.0); // sphere at (1, 0, 0.0)
glutSolidSphere(0.3, 10, 8);
glPopMatrix();
in this case we have:
origin --> light source(0.1,0,0) --> solidsphere (1,0,0)
i think the left side of solidsphere is lighted, but when i run the program , the right side of solidsphere is lighted
)I think this problem because OpenGL draw solidsphere at (0,0,0) and tranlate in to (1,0,0))
can I solve this problem??