I find it pretty tough to do on the fly to be honest. It's something I've had to deal with recently in a country project, swapping from acoustic guitar with a capo, to bass, to lead guitar[i].[/i]
Personally I think the best way is to think of the chord numbers as opposed to the names. So instead of think G, C, D, think of it as I, IV, V. Then once you have found the root for the first chord it should be easier to play the necessary intervals.