Ab-initio calculations for the electronic spectra of cubic and hexagonal BN