Program: 39552
Project: 39552
Buggy source:
protected void drawSetupLights(){
  for (int glIndex=0; glIndex < NUM_GLLIGHTS; glIndex++) {
    if (_scene.lights().glIndexEnabledDirty()[glIndex] == true) {
      if (_scene.lights().glIndexEnabled()[glIndex] == true) {
        _gl.glEnable(GL10.GL_LIGHT0 + glIndex);
        _scene.lights().getLightByGlIndex(glIndex).setAllDirty();
      }
 else {
        _gl.glDisable(GL10.GL_LIGHT0 + glIndex);
      }
      _scene.lights().glIndexEnabledDirty()[glIndex]=false;
    }
  }
  Light[] lights=_scene.lights().toArray();
  for (int i=0; i < lights.length; i++) {
    Light light=lights[i];
    if (light.isDirty()) {
      int glLightId=GL10.GL_LIGHT0 + _scene.lights().getGlIndexByLight(light);
      if (light.position.isDirty()) {
        light.commitPositionAndTypeBuffer();
        _gl.glLightfv(glLightId,GL10.GL_POSITION,light.positionAndTypeBuffer());
        light.position.clearDirtyFlag();
      }
      if (light.ambient.isDirty()) {
        light.ambient.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_AMBIENT,light.ambient.floatBuffer());
        light.ambient.clearDirtyFlag();
      }
      if (light.diffuse.isDirty()) {
        light.diffuse.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_DIFFUSE,light.diffuse.floatBuffer());
        light.diffuse.clearDirtyFlag();
      }
      if (light.specular.isDirty()) {
        light.specular.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_SPECULAR,light.specular.floatBuffer());
        light.specular.clearDirtyFlag();
      }
      if (light.emissive.isDirty()) {
        light.emissive.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_EMISSION,light.emissive.floatBuffer());
        light.emissive.clearDirtyFlag();
      }
      if (light.type() == LightType.DIRECTIONAL && light.direction.isDirty()) {
        light.direction.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_SPOT_DIRECTION,light.direction.floatBuffer());
        _gl.glLightf(glLightId,GL10.GL_SPOT_CUTOFF,60.0f);
        light.direction.clearDirtyFlag();
      }
      if (light.isVisibleBm().isDirty()) {
        if (light.isVisible()) {
          _gl.glEnable(glLightId);
        }
 else {
          _gl.glDisable(glLightId);
        }
        light.isVisibleBm().clearDirtyFlag();
      }
      if (light.attenuation().isDirty()) {
        _gl.glLightf(glLightId,GL10.GL_CONSTANT_ATTENUATION,light.attenuation().getX());
        _gl.glLightf(glLightId,GL10.GL_LINEAR_ATTENUATION,light.attenuation().getY());
        _gl.glLightf(glLightId,GL10.GL_QUADRATIC_ATTENUATION,light.attenuation().getZ());
      }
      light.clearDirtyFlag();
    }
  }
}

Fixed version (ground truth):
protected void drawSetupLights(){
  for (int glIndex=0; glIndex < NUM_GLLIGHTS; glIndex++) {
    if (_scene.lights().glIndexEnabledDirty()[glIndex] == true) {
      if (_scene.lights().glIndexEnabled()[glIndex] == true) {
        _gl.glEnable(GL10.GL_LIGHT0 + glIndex);
        _scene.lights().getLightByGlIndex(glIndex).setAllDirty();
      }
 else {
        _gl.glDisable(GL10.GL_LIGHT0 + glIndex);
      }
      _scene.lights().glIndexEnabledDirty()[glIndex]=false;
    }
  }
  Light[] lights=_scene.lights().toArray();
  for (int i=0; i < lights.length; i++) {
    Light light=lights[i];
    if (light.isDirty()) {
      int glLightId=GL10.GL_LIGHT0 + _scene.lights().getGlIndexByLight(light);
      if (light.position.isDirty()) {
        light.commitPositionAndTypeBuffer();
        _gl.glLightfv(glLightId,GL10.GL_POSITION,light.positionAndTypeBuffer());
        light.position.clearDirtyFlag();
      }
      if (light.ambient.isDirty()) {
        light.ambient.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_AMBIENT,light.ambient.floatBuffer());
        light.ambient.clearDirtyFlag();
      }
      if (light.diffuse.isDirty()) {
        light.diffuse.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_DIFFUSE,light.diffuse.floatBuffer());
        light.diffuse.clearDirtyFlag();
      }
      if (light.specular.isDirty()) {
        light.specular.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_SPECULAR,light.specular.floatBuffer());
        light.specular.clearDirtyFlag();
      }
      if (light.emissive.isDirty()) {
        light.emissive.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_EMISSION,light.emissive.floatBuffer());
        light.emissive.clearDirtyFlag();
      }
      if (light.type() == LightType.DIRECTIONAL && light.direction.isDirty()) {
        light.direction.commitToFloatBuffer();
        _gl.glLightfv(glLightId,GL10.GL_SPOT_DIRECTION,light.direction.floatBuffer());
        _gl.glLightf(glLightId,GL10.GL_SPOT_CUTOFF,45f);
        light.direction.clearDirtyFlag();
      }
      if (light.isVisibleBm().isDirty()) {
        if (light.isVisible()) {
          _gl.glEnable(glLightId);
        }
 else {
          _gl.glDisable(glLightId);
        }
        light.isVisibleBm().clearDirtyFlag();
      }
      if (light.attenuation().isDirty()) {
        _gl.glLightf(glLightId,GL10.GL_CONSTANT_ATTENUATION,light.attenuation().getX());
        _gl.glLightf(glLightId,GL10.GL_LINEAR_ATTENUATION,light.attenuation().getY());
        _gl.glLightf(glLightId,GL10.GL_QUADRATIC_ATTENUATION,light.attenuation().getZ());
      }
      light.clearDirtyFlag();
    }
  }
}