//glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 20); // not sure if I need it...

So I have this surface, I position the cone light above it (Y axis) and I want this cone of light to shine on the surface`s center. I normalized the vector, doublechecked everything, but all I got so far is that the said surface is dimmed, no source of light in sight...
I've been looking for a simple source code containing a simple light source, but I found none.

I think the problem is with the light direction vector. You've entered the coordinates of
the point you'd like the light to look at. That's not how it works. You're supposed to enter theDIRECTION the light is looking in. If you want a light at {0,3,0} to be looking back at
the origin, you should use {0,-1,0}. Good luck.

Hi,
OpenGL fixed function pipeline calculates lighting per-vertex and for the example mesh you have only 4 vertices. May be your spot light is having some effect on the center of the mesh but since there is not vertex nothing is lit. I would suggest you either increase the mesh vertex density to have more vertices in between. Another thing u can do is try out a glutSolidTeapot instead to see if u get something on it.

Hi,
OpenGL fixed function pipeline calculates lighting per-vertex and for the example mesh you have only 4 vertices. May be your spot light is having some effect on the center of the mesh but since there is not vertex nothing is lit. I would suggest you either increase the mesh vertex density to have more vertices in between. Another thing u can do is try out a glutSolidTeapot instead to see if u get something on it.

See if this helps.
Mobeen

Hi
I have a header file like that. I'm willing to create a grid. By using OpenGl and C++. The problem is in there cpp file. I can't excatly draw. Hope you can help it.
In the for loop i don't know how to fill inside the vertex blocks

So i took Nowhere`s and Mobeen`s advices, and first I changed exponent value to like 4, and then tried to set a light on a teapot. After some adjustments, I was able to get a circle of light on said teapot, but there's something wrong with position and direction of the light. If I set the values to:
GLfloat light_pos[] = {10,2,8,1.0};
GLfloat light_dir[] = {-10,-2,-8};
the source of light appears to shine from the side on the teapot's side, as expected. But if I want the light to lightn the top of the teapot, I have to set the position and direction to
GLfloat light_pos[] = {0,-8,0,1.0};
GLfloat light_dir[] = {0,8,0};
And it seems to me like the light should lighten the bottom of the teapot instead of its top...
Then I tried to lighten the surface, I changed it to GL_POLYGON and declared 4 times as many vertexes, coz I`m not sure how many wil do...
Then about the normal vector, should it still be (0,1,0) since the Y axis values seems to be reversed?