strange light behaviour

I am trying to light a surface made from a few triangle strips but when putting the light in the middle only half of the patch gets lit.

you can see a picture of it at http://www.empetre.nu/ljusfel2.jpg

my code looks like this:

#include <stdlib.h>
#include <GL\glut.h>
#include <math.h>
#include “lighting.h”

static GLfloat rot = 0.0;
static GLfloat roty = 0.0;

Patch_3D thePatch(15, 15);

GLdouble coord_x = thePatch.X/2;
GLdouble coord_y = 2;
GLdouble coord_z = thePatch.Z/2;
GLdouble f = 0.5;

bool points = true;
bool lines = true;
bool surface = true;
bool hoger = true;
bool animated = false;

GLfloat light_position[] = {0.0, 0.0, 0.0, 1.0};

void init(void){
glClearColor(0.0, 0.0 ,0.0 ,0.0);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLineWidth(1);
glPointSize(3);
glEnable(GL_DEPTH_TEST);

    GLfloat light_ambient[] = {0.0, 0.0, 0.0, 1.0};
    GLfloat light_diffuse[] = {0.7, 0.7, 0.7, 1.0};
    GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0};

    glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
    glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
    glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);

    glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.0);
    glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.0);
    glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.0);

    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    glEnable(GL_COLOR_MATERIAL);
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);

    glEnable(GL_AUTO_NORMAL);
    glEnable(GL_NORMALIZE);

}

void ShowSurface(Patch_3D thePatch){
glColor3f(0.0, 0.0, 1.0);
for(GLuint i = 0; i < thePatch.X-1; i++){
glBegin(GL_TRIANGLE_STRIP);
for(GLuint j = 0; j < thePatch.Z; j++){
glVertex3fv(thePatch.points[i][j]);
glVertex3fv(thePatch.points[i+1][j]);
}
glEnd();
}
}

void display(void){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

    glRotatef(rot, 0.0, 0.0, 1.0);

    light_position[0] = 7.5;
    light_position[1] = 0.0;
    light_position[2] = 7.5;
    light_position[3] = 1.0;

    gluLookAt(coord_x, 10, coord_z, coord_x, coord_y, 0.001+coord_z,0.0, 1.0, 0.0);    //Top view

    glLightfv(GL_LIGHT0, GL_POSITION, light_position);

    glScalef(1.0, 1.0, 1.0);

    if(surface)     ShowSurface(thePatch);
    if(lines)       ShowLines(thePatch);
    if(points)      ShowPoints(thePatch);

    glutSwapBuffers();

}


void reshape(int w, int h){
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho(-1.5, 1.5, -1.5*(GLfloat)h/(GLfloat)w,
1.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
else
glOrtho(-1.5*(GLfloat)w/(GLfloat)h, 1.5*(GLfloat)w/(GLfloat)h,
-1.5, 1.5, -10.0, 10.0);
gluPerspective(60.0, 1.0, 1.5, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}

If anyone could tell me what I’m doing wrong I would really appreciate it!!

/M
[Edit: added reshape]

[This message has been edited by Norling (edited 04-02-2002).]

no one answered… not that it mattered… I realized that if you are stupid enough to start lighting things without calculation normals you deserve to get errors…

Sometimes the best way to learn is to find out the error yourself!

Happy to hear your problem is solved, if you had waited a little longer one of us would have given you a answer…
Not everyone is on here 24/7.

Originally posted by Norling:
no one answered… not that it mattered… I realized that if you are stupid enough to start lighting things without calculation normals you deserve to get errors…

[This message has been edited by nexusone (edited 04-02-2002).]

don’t worry I know…
I was just a little tired…