The flat brimmed baseball hat is said to have originated from Oakland and California.
"The first thing people did when buying a baseball hat in the 90's was bend the brim. Crack and drug dealers would wear glasses and a hat with a straight brim to throw off the stereotypical image" (of a backwards cap or bent baseball cap which was commonly worn in the 1990's)
"I wear these glasses so i can look like a square, but if you see me in a fight with a bear, don't help me nigga, help the bear"
The style generally moved to the gangster rap scene in the mid to late 90's to associate the rappers with drug dealers, wearing clothes straight off the rack (tags included) and being clean cut and fresh.
Post 2005 people without idea of origin wear the hat as the new style, rarely bending the brim in an "on field" cap style, this style is associated with post 1990 born, any social group from club goers to skaters.
Sources: Rapper, Slang inventor and style originator E-40 mentions in a documentary Blueprint of a self made Millionaire, where the style originated.
No gangster rap vidoes before 1994 featured a straight brim hat.
You looked like a nerd NOT having a Flat-Brimmed Hat and wearing glasses late 1980's early 90's.
You looked like you sold drugs wearing a Flat-Brimmed Hat hat mid 90's
You looked like a rapper late 90's fresh and clean cut possibly mating colours to your clothes and shoes.
You look like a try hard wearing a straight brim hat post 2005.