the above code what I would like to do is keep the height fixed and scale the width.

I'd like to have a design resolution say 320x480 view that's always centered and if I have a fixed height the width scales out horizontally or fixed width and have the top and bottom stretch like the image below.

There's the view projection matrix, the glviewport and orthographic projection that all just seem to be a bit much to wrap my head around it all.