title: c++ Lighting Multiple Objects
body: <p><img src="https://i.stack.imgur.com/Tamg2.png" alt="enter image description here"></p>
  
  <p>in the picture you can see a white dote were the light source is positioned. The right object lights correctly but the left one does not.</p>
  
  <pre><code>GLfloat LightPosition[] = {0.0f,0.0f,1.0f,0.0};
  void render()
  {
      ::clearScreen(); // clear screen
      ::camera-&gt;update(); //changes matrix for camera
  
      glPushMatrix();
      glRotatef(x,0,1,0);
      glTranslatef(0,0,1);
      glBegin(GL_POINTS); // draw white dot
      glVertex3f(LightPosition[0],LightPosition[1],LightPosition[2]);
      glEnd();
  
      glLightfv (GL_LIGHT0,GL_POSITION,LightPosition); // position light
      ::glPopMatrix();
  
      ::m2-&gt;draw(); // draw king chess piece
  
      ::glPushMatrix();
      glTranslatef(4,0,0);
      m1-&gt;draw(); // draw sphere
      ::glPopMatrix();
  
      glFlush();
      glutSwapBuffers();
  }
  </code></pre>
  
  <p>i understand that im just lighting up both objects as if the were in the center of the world and then im translating the object to the left causing this effect. How do i get around this and have my objects light correctly?</p>