Revert "issue #2347 : Replace stencil mechanism with a new approach, remove glColorMask call"

This reverts commit ff79a1b25d5d7323c27045812920a16021a79591.