Changing the height and radius of a cylinder

Hi everyone!

It might be simple, but I have a lot of trouble resizing the height of a cylinder. For instance, if I have this (basic cylinder with height of 1, radius of 1) :



And I want this (cylinder with radius of 0.25 and height of 2:



How do I do that?

I’ve tried with glScalef(height,radius,radius), but it gives me some weird transformation.
Anyways, if someone could help me I would be happy!