How does mask affect stencil value according to stencil op? <p>The documentation in OpenGL reference pdf (both OpenGL 3.3 and 4.5 specs) is not much clear about what happens to the stored stencil value when a mask is applied.</p> <p>In example If I have the following mask:</p> <pre><code>glStencilMask( 0x06); </code></pre> <p>and stored in the stencil buffer there is already this value:</p> <pre><code>0x06 </code></pre> <p>If the stencil operation is <code>GL_INCR_WRAP</code></p> <p>what should happens when StencilOp is correctly invoked on that pixel?</p> <p>Basically I have the mask:</p> <pre><code>00000110 </code></pre> <p>and the value</p> <pre><code>00000110 </code></pre> <p>and I try to increment it, is it wrapped?</p> <pre><code>00000010 </code></pre> <p>or is it just zeroed? <code>(00000110 + 1) &amp; mask</code></p> <pre><code>00000000 </code></pre>