We establish an ambient light with the function call
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, C);
where C represents an array of four float values that hold the ambient light's color. (You can also give the color as four individual float values using the function glLightModelf). For the ambient light to be applied, we must also enable lighting with the function call
glEnable(GL_LIGHTING);
When using lighting in a scene, objects must have a material color versus a "simple" color. In turn, before making OpenGL calls that draw the geometry, we must make a call to the material function
glMaterialfv(GL_FRONT, GL_AMBIENT, C);
where C again represents an array of four float values and establishes the object's ambient material color. Note that the GL constants GL_BACK and GL_FRONT_BACK can be used in place of GL_FRONT. Anyone of the three establishes which faces of the object are updated, front, back or both.