Aims. In the context of the core instability model, we present calculations of in situ giant planet formation. The oligarchic growth regime of solid protoplanets is the model adopted for the growth of the core. Methods. The full differential equations of giant planet formation were numerically solved with an adaptation of a Henyey-type code. The planetesimals accretion rate was coupled in a self-consistent way to the envelope's evolution. Results. We performed several simulations for the formation of a Jupiter-like object by assuming various surface densities for the protoplanetary disc and two different sizes for the accreted planetesimals. We find that the atmospheric gas drag gives rise to a major enhancement on the effective capture radius of the protoplanet, thus leading to an average timescale reduction of 30% -- 55% and ultimately to an increase by a factor of 2 of the final mass of solids accreted as compared to the situation in which drag effects are neglected. With regard to the size of accreted planetesimals, we find that for a swarm of planetesimals having a radius of 10 km, the formation time is a factor 2 to 3 shorter than that of planetesimals of 100 km, the factor depending on the surface density of the nebula. Moreover, planetesimal size does not seem to have a significant impact on the final mass of the core.