The behavior of both of those functions, in general, is different:
glDrawBuffer
controls writes to an entire color buffer. You can use it to enable or disable all writes to the front left, front right, back left, or back right buffers (or to some combination thereof).
glColorMask
, however, controls writes of entire color channels to all color buffers (the related function, glColorMaski
can be used to control entire color channels for a specific buffer).
In the case where you using the functions as specified, the effective result is the same for both calls: glDrawBuffer(GL_NONE)
specifies that no buffers are to be drawn to, whereas glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)
specifies that no colors are to be written to all buffers.
In general, of course, the behavior is different. You'd use glColorMask
if you wanted to only disable writes of the red color channel; glDrawBuffer
does not give you that kind of granularity. However, glColorMask
only makes sense in RGBA mode, but it has a nice parity with other masking functions like glDepthMask
. Et cetera.
In the case where the effective result would be the same, you can choose whichever function you like best... and it doesn't make sense to do both, as you are implying some tutorials suggest.