By action:
By the item (badge or ID Card)Texas Penal Code - PENAL § 37.11. Impersonating Public Servant
(a) A person commits an offense if he:
(1) impersonates a public servant with intent to induce another to submit to his pretended official authority or to rely on his pretended official acts; or
(2) knowingly purports to exercise any function of a public servant or of a public office, including that of a judge and court, and the position or office through which he purports to exercise a function of a public servant or public office has no lawful existence under the constitution or laws of this state or of the United States.
So, just having a badge is not illegal, but telling them you are a peace officer or getting them to submit to a search by implying your are a cop, etc while wearing a badge or ID holder will probably get you arrested. Depending on the credibility of the witness, they may decide to prosecute you.(a) Texas Penal Code - PENAL § 37.12. False Identification as Peace Officer; Misrepresentation of Property
A person commits an offense if:
(1) the person makes, provides to another person, or possesses a card, document, badge, insignia, shoulder emblem, or other item bearing an insignia of a law enforcement agency that identifies a person as a peace officer or a reserve law enforcement officer; and
(2) the person who makes, provides, or possesses the item bearing the insignia knows that the person so identified by the item is not commissioned as a peace officer or reserve law enforcement officer as indicated on the item.