Lighting questions and problems

hi all ! Im new here and Im tryning to code a opengl app, so far I got my model into game and a moving camera with the mouse. But Im having issues to setup the lights.

  1. My idea is to create a soccer stadium, so wich is the best approach? just code spot lights to cover the whole scene?

  2. So far I have this (the idea is to load the lights from an ASE file),but this is for testing:


CGL_Light3D::CGL_Light3D () {

	   m_pSphere = NULL;
   m_pSphere = gluNewQuadric();

	ambient[0] = 5.0f;
	ambient[1] = 1.0f;
	ambient[2] = 1.0f;
	ambient[3] = 1.0f;

	     diffuse[0] = 1.0f;
	 diffuse[1] = 1.0f;
     diffuse[2] = 1.0f;
     diffuse[3] = 1.0f;

	  specular[0] = 0.0f;
      specular[1] = 0.0f;
      specular[2] = 0.0f;
      specular[3] = 1.0f;

   position[0] = 0.0f;
   position[1] = 1.0f;
   position[2] = 0.0f;
   position[3] = 0.0f;

   spot_direction[0] =  0.0f;
   spot_direction[1] =  0.0f;
   spot_direction[2] = -1.0f;

   spot_exponent = 0.0f;
   spot_cutoff = 90.0f;

   constant_attenuation  = 1.0f;
   linear_attenuation    = 0.0f;
   quadratic_attenuation = 0.0f;


void CGL_Light3D::TurnOn ( int light ) {





	glLightfv(LIGHT, GL_POSITION, position);
	glLightfv(LIGHT, GL_AMBIENT, ambient);
    glLightfv(LIGHT, GL_DIFFUSE, diffuse);
    glLightfv(LIGHT, GL_SPECULAR, specular);
	glLightf(LIGHT, GL_SPOT_EXPONENT,spot_exponent);
	glLightfv(LIGHT, GL_SPOT_DIRECTION, spot_direction);
	glLightf(LIGHT, GL_SPOT_CUTOFF,spot_cutoff);
	glLightf(LIGHT, GL_CONSTANT_ATTENUATION, constant_attenuation);
	glLightf(LIGHT, GL_LINEAR_ATTENUATION, linear_attenuation);
	glLightf(LIGHT, GL_QUADRATIC_ATTENUATION, quadratic_attenuation);



void CGL_Light3D::Render(glCamera *Cam)


 // glLoadIdentity();
  gluLookAt(Cam->m_Position.x, Cam->m_Position.y, Cam->m_Position.z,0.0,0.0,0.0, 0.0, 1.0, 0.0);

//  glRotatef(m_lightAngle, 1.0, 0.0, 0.0);
//  glRotatef(m_lightAngle, 0.0, 1.0, 0.0);
  glTranslatef(position[0], position[1], position[2]);
  gluSphere(m_pSphere, 100.0f, 10, 10);


Lights.SetPosition(-2022.3320f,	-1185.0239f,	1263.6978f,1.0);
	Lights.SetSpotDirection(82.0830f,	-17.6392f,	0.0000f);
	Lights.SetAmbientColor(0.8980f,	0.1373f,	0.1373f,  0.0f);
//	Lights.SetSpotCutoff(43.0000f);

My problem is that I have the light in the scene, at least I can see some red… but the light behaves as flash light that moves with the camera (split the camera in half and the right side is lighted while the left one is not).

Also the sphere, wich I use as reference, behaves in a weird way moving with the camera…

The help is appreciated.

It’s probably best to use a textured light map where you can paint spotlights onto the lightmap image and apply that to the field and color the players by sampling the right place on the image either in software or using texgen.