Opengl - Jumpy lighting

My one light seems to ‘jump’ and not flow smoothly across my floor tile texture.

It’s much better explained in this short youtube video youtube link
Note that my light is not going somewhere and coming back; it is always located half way between the camera and the cube.

This is my function for drawing the floor tiles:


void drawFloor(){

	float size = 20.0;
	float startX = -60.0f;
	float startZ = 60.0f;

	glDisable(GL_COLOR_MATERIAL);

	glPushMatrix();

	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, _textureId);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	//glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

	for(int x = 0;x < 6; x++){
		for(int z = 0;z < 6; z++){

			glBegin(GL_QUADS);

			glNormal3f(0.0f, 1.0f, 0.0f);
			 glTexCoord2f(0.0f, 0.0f);
			glVertex3f(startX + size*x, 0.0f, startZ + -size*z);//bottom-left
			 glTexCoord2f(1.0f, 0.0f);
			glVertex3f(startX + size + size*x, 0.0f, startZ + -size*z);//bottom-right
			 glTexCoord2f(1.0f, 1.0f);
			glVertex3f(startX + size + size*x, 0.0f, startZ + -size + -size*z);//top-right
			 glTexCoord2f(0.0f, 1.0f);
			glVertex3f(startX + size*x, 0.0f, startZ + -size + -size*z);//top-left

			glEnd();
		}
	}

	glDisable(GL_TEXTURE_2D);

	glPopMatrix();

	glEnable(GL_COLOR_MATERIAL);

}

Question: How can i make my light not jump and light the tiles smoothly?

O_o. I do not think it links to what you wanted it to.

Fixed*

Thanks for catching that, i was very tired when i posted this

Bump

and where’s the code which handles the lighting? Can’t fix lighting with seeing lighting code you know :wink:

Random guess: you use per vertex lighting (http://en.wikipedia.org/wiki/Gouraud_shading) and your polygons are just too big for that.

So use shaders to do PPL = per pixel lighting

Ah yes, im going to that now, thanks everyone!

@V-man, nice to see a Canadian opengl programmer =)