glfw: GL_STENCIL_TEST no longer working

Monkey Forums/Monkey Bug Reports/glfw: GL_STENCIL_TEST no longer working

Nobuyuki(Posted 2016) [#1]
Hello,

I don't know when this happened, but on my Windows 10 machine, the glfw target doesn't seem to want to cooperate and let me do arbitrary stencil operations. Example code can be downloaded here:

https://github.com/nobuyukinyuu/nDrawExts2

Check the screenshot on the Github page for what the arbitrary stencil SHOULD look like. When compiling to Android (API_10), the code works just like in the screenshot, and in previous versions of Monkey, this also worked (although needed a bit of a workaround to get it to work on MacOS; re-initializing the window with 8 bit depth allocated to the stencil buffer, I'm assuming because it defaulted to a nonsupported value). In the new version of Monkey, I had to use SetDeviceWindow, but I think the code was working even then, although I could be wrong, because it was updated "in a hurry" just to get it to compile again.

Here's what it looks like now; the behavior's clearly broken, and the stencil mask is clearly passing everything to be drawn.


I tried it without SetDeviceWindow(), and the result was the same. Am I missing some voodoo here, or did the change over to this as a documented feature disable stencil bit processing entirely?


Nobuyuki(Posted 2016) [#2]
Figured out the issue. My current workaround involves editing the GLFW3 target. Please consider a patch!

In \targets\glfw3\modules\native\glfwgame.cpp , line 579, change the following line:
glfwWindowHint( GLFW_STENCIL_BITS,0 );


to this:
glfwWindowHint( GLFW_STENCIL_BITS,8 );


A new flag for SetDeviceWindow could also do, if you don't want the stencil channel to be enabled by default....


Nobuyuki(Posted 2016) [#3]
I've created a pull request for this issue, with a conservative approach just in case there's a reason to have the default stencilbits hint set at 0. Please consider...
https://github.com/blitz-research/monkey/pull/89