Right side and Left side Lighting not happening

Dear All,

I wrote the following code for enabling Lighting from the left side of axes( -1.0,0,0,1.0, 1.0) and Right side (1.0,0.0,1.0,0.0) of the axes using Keys. But When I press keys the either the whole light of the scene gets disabled or enabled . The following is the code. Please tell where I am doing wrong. Iwant the right side light to disable when I press ‘R’ and left side light to disable

#include <GL/glut.h>

enum {
LIGHT_OFF,LIGHT_RED,LIGHT_WHITE,LIGHT_GREEN} LightValues;
GLfloat red_light[] = {1.0, 0.0, 0.0, 1.0};
GLfloat green_light[] = {0.0,1.0,0.0,1.0};
GLfloat white_light[] = {1.0,1.0,1.0,1.0};
GLfloat left_light_position[] = {-1.0, 0.0, 0.0, 1.0}; /* Left Light /
GLfloat right_light_position[] = {1.0,0.0,1.0,1.0}; /
Right Light */

void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glScalef(1.0,1.,1.);
glutSolidTorus(0.275,0.85,10,15);
glutSwapBuffers();
}

void keyboard(unsigned char key,int x, int y)
{

switch(key)
{
	case 'L':
		glDisable(GL_LIGHT0);
		glEnable(GL_LIGHT1);
		break;
	case 'R':
		glDisable(GL_LIGHT1);
	 	glEnable(GL_LIGHT0);		
		break;		
}
glutPostRedisplay();

}
void
init(void)
{
/* Enable a single OpenGL light. */
glLightfv(GL_LIGHT0, GL_POSITION, left_light_position);
glLightfv(GL_LIGHT0, GL_SPECULAR,white_light);
glLightfv(GL_LIGHT1, GL_POSITION,right_light_position);
glLightfv(GL_LIGHT1, GL_SPECULAR,white_light);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);

/* Use depth buffering for hidden surface elimination. */
glEnable(GL_DEPTH_TEST);

glMatrixMode(GL_PROJECTION);
gluPerspective( /* field of view in degree / 40.0,
/
aspect ratio / 1.0,
/
Z near / 1.0, / Z far */ 10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

gluLookAt(0.0, 0.0, 3.0, /* eye is at (0,0,5) /
0.0, 0.0, 0.0, /
center is at (0,0,0) /
0.0, 1.0, 0.); /
up is in positive Y direction */

glTranslatef(0.0, 0.0, -1.0);
glRotatef(60, 1.0, 0.0, 0.0);
glRotatef(-20, 0.0, 0.0, 1.0);
}

int
main(int argc, char **argv)
{

glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutCreateWindow(“red 3D lighted cube”);
glutDisplayFunc(display);
init();
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

Thanks in advance

Dear All,

Can anybody examine the above written code

regards