elm-explorations / webgl

Functional rendering with WebGL in Elm
https://package.elm-lang.org/packages/elm-explorations/webgl/latest/
BSD 3-Clause "New" or "Revised" License
116 stars 17 forks source link

Fix resetting write masks for the depth and stencil buffers #20

Closed w0rm closed 5 years ago

w0rm commented 5 years ago

The gl.clear depends on the ability to write into the stencil or depth buffer. This is controlled by the corresponding write masks (gl.depthMask and gl.stencilMask), that weren’t correctly reset after each entity. This caused a bug: if the last entity disables writing to the depth or the stencil buffers, then this prevents the corresponding buffer from being cleared for the next frame.

This pr properly resets the depth and stencil masks. The depth mask is set to true. The stencil mask is set to the initial value, because it is a bit mask and different browsers have different number of stencil bits.