Dear All,
I am renderng a move around a scene(using camera movement techniques). I have defined both ambient and position of the light in the scene.I want tthe light to be lit whereever we are moving in the scene. But I am not getting the desired effect. As I move around the scene,some parts are recieving the light and other parts are looking very dark.Moreover a polygon which have drawn(having blue color)
is rendered with a black color. I am giving the necessary code given below.
/* Light Declaration */
static GLfloat lightpos[] =
{1.0f,1.0f,1.0f,1.0f};
GLfloat ambient[] = { 1.0, 1.0, 1.0, 1.0 };
/* Light Definition */
void renderscene( )
{
glLoadIdentity();
gluLookAt(x, y, z,
x + lx,y + ly,z + lz,
0.0f,1.0f,0.0f);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
glLightfv(GL_LIGHT0,GL_POSITION,lightpos);
/* Here I am 100 x 100 Floor /
/ Rest the code for code for other scenes /
for( i = -10; i < 10; i++)
for(int j = -10; j < 10; j++)
{
glPushMatrix();
glTranslatef(5+i10.0,0,5+j * 10.0);
draw_house()
}
}
kindly tell me how to create the light.
Thanks