Macbooks and iMacs do not have a video in port, so you won't be able to do that unless you buy something like the elgato eyetv, but that would be a freaky mess of cables and a pain to work.
for a projector, you'd need the official apple cable plus probably another cable to match the projector's input.