Original Post
Hi, i'm trying to get a spot light to shine down on the floor in my program and I'm getting a strange result. The spot light is shining down on the floor okay and the beam is fairly narrow(i'll put more polygons in later to improve the effect). The floor spans along the z-axis so the bottom is z-(1.0) and the top z-(15.0) Anyway i speciy the position and direction of the light to shine down on the bottom of floor yet when i run the program it appears to be shining down in the center coz the center is quite bright and front and back dark. Heres the relevant code so u can see where i'm setting everything up, i've not done much lighting so maybe i'm doing the totally wrong thing. int InitGL(GLvoid) { glClearColor (0.0, 0.0, 0.0, 0.0); glEnable(GL_BLEND); glEnable(GL_POLYGON_SMOOTH); glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); GLfloat ambient[] = {0.0,0.0,0.0,1.0}; GLfloat diffuse[] = {1.0,1.0,1.0,1.0}; GLfloat specular[] = {0.0,0.0,0.0,1.0}; glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse); glLightfv(GL_LIGHT0, GL_SPECULAR, specular); glLightf(GL_LIGHT0, GL_SPOT_EXPONENT,128.0); glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 10.0); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE); return TRUE; } void RenderScene() { //spot light looking straight down at the front of the floor GLfloat position[] = {0.0,5.0,1.0,1.0}; GLfloat spot_direction[] = {0.0,-2.0,1.0,1.0}; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); //set camera g_Camera.PositionCamera(0.0,4.0,1.0, 0.0,-1.9,15.0, 0.0,1.0,0.0); g_Camera.Look(); glLightfv(GL_LIGHT0, GL_POSITION, position); glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION,spot_direction); glPushMatrix(); \\Floor made up of quads drawFloor(); glPopMatrix(); glPopMatrix(); } int DrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); RenderScene(); return TRUE; } I think thats all the relevant stuff, any help in fixing it or maybe an alternative method appreciated.