We present a full general relativistic numerical code for estimating the energy–momentum deposition rate (EMDR) from neutrino pair annihilation (). The source of the neutrinos is assumed to be a neutrino-cooled accretion disc around neutron and quark stars. We calculate the neutrino trajectories by using a ray-tracing algorithm with the general relativistic Hamilton's equations for neutrinos and derive the spatial distribution of the EMDR due to the annihilations of neutrinos and antineutrinos around rotating neutron and quark stars. We obtain the EMDR for several classes of rotating neutron stars, described by different equations of state of the neutron matter, and for quark stars, described by the Massachusetts Institute of Technology (MIT) bag model equation of state and in the colour–flavour-locked (CFL) phase. The distribution of the total annihilation rate of the neutrino–antineutrino pairs around rotating neutron and quark stars is studied for isothermal discs and accretion discs in thermodynamical equilibrium. We demonstrate both the differences in the equations of state for neutron and quark matter and rotation with the general relativistic effects significantly modify the EMDR of the electrons and positrons generated by the neutrino–antineutrino pair annihilation around compact stellar objects, as measured at infinity.