'Draw a "transparent" triangle over dark background in monogame
I am trying to have a "night" effect on my screen, by setting dark background
spriteBatch.Begin();
// my objects here
spriteBatch.Draw(darkBackground, Vector2.Zero, Color.White);
spriteBatch.End();
and then drawing a transparent triangle ("flashlight")
GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertexPositionColors, 0, 1);
How do I make my triangle to "clear up" the background, without affecting my other objects. I was trying to do it with BlendState
, but not could not make it working
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|