OpenGL Stencil buffer problem on NVIDIA graphics card

Hello. I have some trouble when using opengl stencil buffer on NVIDIA cards. I made a MonoGame Cross Platform Desktop Project (uses OpenGL). I follow this tutorial: to do alpha masking with stencil buffer.
The result should be like this:

I have notebook with integrated graphics card (Intel HD Graphics 5500) and it works on it, but when i run it using dedicated NVIDIA card (GeForce 940M) i’ve got this:

I updated my drivers but nothing helped. I also tried running it on diffrent computers with NVIDIA cards (GT 7300GT and GeForce 220M) and problem also exists here.

Additionaly I’ve created MonoGame Windows Project (uses DirectX) and all works okay on integrated graphics card as well as on dedicated NVIDIA card.

Here is my source code (generally it’s the same as in tutorial to be sure the validity of code):

Link to full Visual Studio solution of example: https// (put color after https, i can’t add more links)

Thanks for help.

Since this works for DX with the same code, this is a bug in MonoGame, an issue for it should be opened on the github page

But on Intel’s graphics card using OpenGL it works. Issue only exists on NVIDIA cards. I don’t know for ATI because I don’t have one. I will open issue on GitHub.

I’ve created an Android game with this code and on my phone (Samsung Galaxy Mini 2 GT-S6500) works okay. It looks like it is only problem on OpenGL Desktop with NVIDIA card.

Okay, issue on GitHub opened - I hope that problem will be repaired :slight_smile: