This, of course includes gay male character (Shonen-ai or Yaoi), and gay female characters (Shoujo-ai, or Yuri).
The existence of such characters isn't necessarily exclusive to yaoi, yuri, shonen-ai, or shoujo-ai anime and manga.
The timpanist from Nodame Cantabile who is also called "the queen of percussion", since he is the best timpanist and openly gay. Masumi has a crush on Chiaki and therefore sees Noda - who claims a lot of Chiaki's attention - as a rival, so he tries to sabotage her. After his rivalry with Noda seems to fade away, he finds a new rival in Takahashi Noriyuki, a great violin player and the newest concertmaster. Just like Masumi, Takahashi is also openly gay and he too has a crush on Chiaki.