Original Post
Hay guys just trying to add some simple diffuse positional lighting to my 3d world. Instead of it going out in all directions it seems to be going a certain way which is not what i want, or do positional lights need a direction? , heres how im setting it up anyway and a screen shot heres a screenshot. the light is positioned just infront of the camera as you can see it seems to be directed in the far distance as its much darker just behind it:
im pretty certain it isnt a position problem as all the co-ords seem to be correct, although im not entirely certain. what you guys think? cheers Si
//global vars
const GLfloat greenLightColor[] = { 0.6f, 0.6f, 0.0f, 1.0f };
GLfloat greenLightPos[] = { 0.0, 0.0, 0.0, 1.0 };
//in initilisation function
glEnable(GL_LIGHTING);
glLightfv(GL_LIGHT2, GL_AMBIENT, greenLightColor);
glLightfv(GL_LIGHT2, GL_DIFFUSE, greenLightColor);
//in rendering function:
glPushMatrix();
glTranslatef(Lx,Ly,Lz); //moves to the position where i want the light
glLightfv(GL_LIGHT2, GL_POSITION,greenLightPos);
glEnable(GL_LIGHT2);
glPopMatrix();