As someone who's Dad was in law enforcement (SB Sheriff actually) and I myself am in the hiring process for SBPD...this is complete bullshit. It seems like this was personal attack on you. You're probably not going to have much luck on fighting the ticket since it's his word against yours (unless the camera shows anything).
There was no reason for him to have his gun upholstered. Are your windows tinted? If not, he may have seen you reaching into the glove box while he was walking up. That's a no-no. Always keep your hands on the wheel until the officer gets there, and then tell him/her what you're about to do, and have them watch you. Especially young cops, they're a little more itchy on the trigger finger.