We present a new code for performing general-relativistic radiation-hydrodynamic simulations of accretion flows on to black holes. The radiation field is treated in the optically thick approximation, with the opacity contributed by the Thomson scattering and thermal bremsstrahlung. Our analysis concentrates on a detailed numerical investigation of hot (T∼ 1010 K) two-dimensional, Bondi–Hoyle accretion flows with various Mach numbers. The asymptotic velocity is in the range v∞∼ (0.08–0.18)c, while the initial rest-mass density is of the order of a few ρ∼ 10−12 g cm−3. We find significant differences with respect to purely hydrodynamical evolutions. In particular, once the system relaxes to a radiation-pressure-dominated regime, the accretion rates become about two orders of magnitude smaller than in the purely hydrodynamical case, remaining however super-Eddington as well as the luminosities. Furthermore, when increasing the Mach number of the inflowing gas, the accretion rates become smaller because of the smaller cross-section of the black hole, but the luminosities increase as a result of a stronger emission in the shocked regions. Overall, our approach provides the first self-consistent calculation of the Bondi–Hoyle luminosity, most of which is emitted within r∼ 100M from the black hole, with typical values L/LEdd≃ 1–7, and corresponding energy efficiencies . The possibility of computing luminosities self-consistently has also allowed us to compare with the bremsstrahlung luminosity often used in modelling the electromagnetic counterparts to supermassive black hole binaries, to find that in the optically thick regime these more crude estimates are about 20 times larger than our radiation-hydrodynamic results.