Flashlight

I m reading the book beginning opengl game programming and i have stumbled upon the capter with lighting.
Basically i have a problem with flash light.
Here is my code:


    gl.glEnable(GL.GL_LIGHTING);
    gl.glEnable(GL.GL_LIGHT0);
    float flashLightPos[] = { 0, 0, 0, 1 };
    float  flashLightDir[] = { 0, 0, -1 };
    float  flashLightColor[] = { 0.2f, 0.2f, 0.2f, 1.0f };

    FloatBuffer pos,color,dir;
    pos=FloatBuffer.wrap(flashLightPos);
    dir=FloatBuffer.wrap(flashLightDir);
    color=FloatBuffer.wrap(flashLightColor);
    gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, pos);
   // gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, color);
   // gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, color);
   // gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, color);
   // gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPOT_DIRECTION, dir);
    gl.glLightf(GL.GL_LIGHT0, GL.GL_SPOT_CUTOFF, 12);
    glu.gluLookAt(0.0, 0.0, 20.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
   
    gl.glBegin(GL.GL_QUADS);
    gl.glNormal3d(0, 0,1);
    	gl.glVertex3f(-15, 10, -5);
    	gl.glVertex3f(-15, -10, -5);
    	gl.glVertex3f(15, -10, -5);
    	gl.glVertex3f(15, 10, -5);
    gl.glEnd();

I commented out direction specification since default is down the negative z axis. Still i see no lighted circle on my poor quad. Tried changing normal also…

I know that it must be a small thing i dont see, plz help me find it.
Tnx.

OpenGL does vertex-lighting when you’re not using shaders:
it only calculates the shade for every vertex, and interpolates the shade across the quad.

You’ll need lots of tiny quads to see the circle, or write a nice fragment-shader

Hmm…that explains a lot.Ty riven…

Though i have one more question:how come other lights work fine(quad is lighten)?

There is no reference to ur answer anywhere in the book…anyway ty again.