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: https://medium.com/@sfranks/i-originally-wrote-this-for-the-best-way-to-mask-2d-sprites-in-xna-game-development-stack-949cf7bd7421#.wji9zxbjd 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): http://pastebin.com/9RMPAV35

Link to full Visual Studio solution of example: https//www.dropbox.com/s/a9ouuysuq4y0sc9/stenciltestogl.zip?dl=1 (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 www.github.com/mono/MonoGame/issues

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 - https://github.com/mono/MonoGame/issues/4960. I hope that problem will be repaired :slight_smile: