Watch the Major Scale & Triad: Key of G online guitar lesson by Rob Garland from Chord Navigator: CAGED Triads
Let's play the scale in another key. Start from the root note of the key (G) and follow the same scale pattern, this gives you G-A-B-C-D-E-F#-G. Because the intervals stay the same in relation to the root meaning the scale pattern is the same, the key of G has one sharp F#.
Major chords are built from the root, 3rd, and 5th of the major scale. If you take the note G as your root note, the 3rd note of the scale is a B and the 5th is a D. Play these three notes together and you have a G major triad. Note that when you play an open G chord you're stacking several of the same notes. This is of course true for any alternative open G chords too.