issue with point and spotlights

Directional lights work just fine with this code, but point and spotlights don’t work at all. Just to clarify, I’m assigning point and spot lights in world coordinates (with the ‘w’ value set to 1.0f). Please take a look at this and tell me if anything raises a red flag:


void setupRC(vector<light> lightInfo)
{
	// Create light components
	GLenum lightArray[]={GL_LIGHT0,GL_LIGHT1,GL_LIGHT2,GL_LIGHT3,GL_LIGHT4,GL_LIGHT5,GL_LIGHT6,GL_LIGHT7};
	//light properties
	GLfloat ambientLight[] = { 0.2f, 0.2f, 0.2f, 1.0f };
	//material properties
	GLfloat specularLight_mat[] = { 1.0f, 1.0f, 1.0f, 1.0f };
	GLfloat shininess_mat[] = { 50.0f };

	glShadeModel(GL_SMOOTH);
	glEnable(GL_COLOR_MATERIAL);

	glMaterialfv(GL_FRONT, GL_SPECULAR, specularLight_mat);
	glMaterialfv(GL_FRONT, GL_SHININESS, shininess_mat);

	glFrontFace(GL_CW);
	glEnable(GL_CULL_FACE);
	glEnable(GL_LIGHTING);

	if(lightInfo.size()<9)
	{
		for(unsigned int lindex=0; lindex<lightInfo.size();lindex++)
		{
			glLightfv(lightArray[lindex],GL_POSITION,lightInfo.at(lindex).lightPosition);
			glLightfv(lightArray[lindex],GL_DIFFUSE,lightInfo.at(lindex).diffuse);
			glLightfv(lightArray[lindex],GL_SPECULAR,lightInfo.at(lindex).specular);
			switch(lightInfo.at(lindex).typeOfLight)
			{
			case POINT:		glLightf(lightArray[lindex], GL_CONSTANT_ATTENUATION, lightInfo.at(lindex).constantAttenuation);
							glLightf(lightArray[lindex], GL_LINEAR_ATTENUATION, lightInfo.at(lindex).linearAttenuation);
							glLightf(lightArray[lindex], GL_QUADRATIC_ATTENUATION, lightInfo.at(lindex).quadraticAttenuation);
							break;
			case SPOTLIGHT:	glLightf(lightArray[lindex], GL_CONSTANT_ATTENUATION, lightInfo.at(lindex).constantAttenuation);
							glLightf(lightArray[lindex], GL_LINEAR_ATTENUATION, lightInfo.at(lindex).linearAttenuation);
							glLightf(lightArray[lindex], GL_QUADRATIC_ATTENUATION, lightInfo.at(lindex).quadraticAttenuation);
							glLightf(lightArray[lindex], GL_SPOT_CUTOFF, lightInfo.at(lindex).spotCutoff);
							glLightfv(lightArray[lindex], GL_SPOT_DIRECTION, lightInfo.at(lindex).spotDirection);
							break;
			default:		break;
			}
			glEnable(lightArray[lindex]);
		}
	}
	else
		cout<<"Error: OpenGL cannot support more than 8 lights!"<<endl;
	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientLight);
	glEnable(GL_DEPTH_TEST);
}

You have not shown us what values you are putting into the lightfv commands - only that it’s some property of lightinfo.

One other thing, when you set the light position - is this before or after you have setup the camera (modelview) matrix?