Cumulus clouds form when heat from the Earth, which has been warmed by the sun, causes convection in the lower atmosphere. The development and height of cumulus clouds will partly depend on the amount of convection, which is linked to the amount of heating.
Strong convection leads to higher cloud tops.
Very often the atmosphere will be layered and winds may be stronger at greater altitudes. If the tops of the cumulus cloud reach a zone where wind speeds are greater, the tops can be sheared in the direction of the prevailing wind. This is called a castellate texture.