Fixed stencil buffer bug - caused by a naming confusion of the meaning of the word "mask",  in the GL function glStencilFunc - the parameter "mask" actually mean mask, but in the function "glStencilMask" the parameter "mask"  actually mean the ref value that will be written to the buffer. The issue was found when running the same code on both D3D9 render system and OpenGL render system and seeing different visual result. After the fix – the results are the same. Credit to Mattan for fixing this issue.
Fixed stencil buffer bug - caused by a naming confusion of the meaning of the word "mask",  in the GL function glStencilFunc - the parameter "mask" actually mean mask, but in the function "glStencilMask" the parameter "mask"  actually mean the ref value that will be written to the buffer.
The issue was found when running the same code on both D3D9 render system and OpenGL render system and seeing different visual result. After the fix – the results are the same.
Credit to Mattan for fixing this issue.
jakzale/ogre,jakzale/ogre,jakzale/ogre,jakzale/ogre,jakzale/ogre