To keep things simple, we will pick an object based on its primitive color. That is, we discard the shiny reflections or shadows, and render the object with its uniform color. This is important, because to pick an object based on a color, we need to make sure that the color is constant per object and that each object has a different unique color.
We achieve constant coloring by telling the fragment shader to use only the material diffuse property to set the ESSL output color variable. We are assuming that each object has a unique diffuse property.
In situations where objects may share the same diffuse color, we can create a new ESSL uniform to store the picking color and make it unique for every object that's rendered into the offscreen framebuffer. This way, the objects will look the same when they are rendered on the screen, but...