Issue when updating stencil buffer in OpenGL

后端 未结 1 1653
春和景丽
春和景丽 2021-01-14 06:03

I\'m having issues when drawing using the stencil test in OpenGL on mac. When I first draw the scene, the stencil works fine. I draw a semi-transparent black rectangle in th

相关标签:
1条回答
  • 2021-01-14 06:25

    The clearing of the stencil buffer does indeed not work (except for the very first time that funtion is called) as you might expect it.

    What you missed is that the glStencilMask will also affect glClear(... | GL_STENCIL_BUFFER_BIT). You should move the glStencilMask(0xFF) up a bit, before doing the clear call.

    0 讨论(0)
提交回复
热议问题