International audienceThe shear modulus G of two glass-forming colloidal model systems in d = 3 and d = 2 dimensions is investigated by means of, respectively, molecular dynamics and Monte Carlo simulations. Comparing ensembles where either the shear strain gamma or the conjugated (mean) shear stress tau are imposed, we compute G from the respective stress and strain fluctuations as a function of temperature T while keeping a constant normal pressure P. The choice of the ensemble is seen to be highly relevant for the shear stress fluctuations mu(F)(T) which at constant tau decay monotonously with T following the affine shear elasticity mu(A)(T), i.e., a simple two-point correlation function. At variance, non-monotonous behavior with a maxim...