Agreement of pronouns and past participles

In Italian what is the official rule as to the gender of the past participle?
As an example. If someone asked me how many glasses of something I bought I would say "Ne ho comprate cinque" as Comprate reffers to Bicchiere. But I can't see another use for this. The 'official' way to go about it would be much appriciated as would correction to my "Italian" (I don't feel justified referring to my abilities as a language by any means of the definition ergo "" )

Attention: The pronouns in my explanation above are direct objects, not indirect ones. I hope you are familiar with this terminology. In some languages, the direct and indirect objects correspond to the accusative and dative, respectively. In Italian, the indirect object typically (if not always) requires "a":
Voglio bene a Lucia.
Voglio regalare i fiori a mia madre.

The agreement of pronouns and participles never occurs if the pronouns are indirect.

Thank you very much Jana! And I'm sorry reviewing my sentances leads me to believe they are completely incorrect. I learned a rule in Spanish I assumed as also true in Italian, specifically the rule of 'required redundancy'. It states that if the sentance had an indirect object (In the Dative case) the indirect object pronoun is needed as well as the modifier. I.E. You could never say "Dí los vasos a él." I gave the glasses to him. Rather, it must be "Le dí los vasos a él. or simply "Se los dí" I gave them to him.