Doing this for anaglyph glasses only requires a few minor modifications. For starters, you draw both passes full-screen, obviously, so don't scale the viewport at all. Instead of drawing them side-by-side, you simply draw them on top of each other.
1. Only glClear() the color buffer at the beginning, but clear the z-buffer on both passes.
2. You mask each pass with the approprite color:
if (pass == 0)
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE);
else
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);
This will draw the first pass with red only. Then the 2nd pass gets drawn with green & blue only.
That is quite literally all there is to it. One other trick, however, is to do some fancy color manipulation on your textures in advance. There is often some color bleed between the red and green channels, so what we would do in our older anaglph games was to pre-scan all of our textures and reduce the green in all of them. We had some fancy algorithms for doing this properly, and some of the games even had calibration dialogs that let the user adjust the color shifting to match their particular monitor and/or anaglyph glasses.
-Brian