1
Graphics / Draw a sprite trough a polygon mask
« on: February 18, 2015, 01:00:33 pm »
I have been making a 2D visiblity algorithm by following this tutorial http://simblob.blogspot.se/2012/07/2d-visibility.html
I have managed to create the light vertices and it works fine when I draw it in a single color, but I want to use a shadow map to get "faded" lights like this: http://i.ytimg.com/vi/2yrgzlRhAes/maxresdefault.jpg
Mine looks like this now: http://i.imgur.com/wAdRBr9.png where the blue dot is the light center and the green is the lighted area.
How can I "apply" a sprite to this like this one: http://www.alcove-games.com/wp-content/uploads/2013/06/light.png ?
My code lies here: https://github.com/doodlemeat/bugfree-octo-sansa
I have managed to create the light vertices and it works fine when I draw it in a single color, but I want to use a shadow map to get "faded" lights like this: http://i.ytimg.com/vi/2yrgzlRhAes/maxresdefault.jpg
Mine looks like this now: http://i.imgur.com/wAdRBr9.png where the blue dot is the light center and the green is the lighted area.
How can I "apply" a sprite to this like this one: http://www.alcove-games.com/wp-content/uploads/2013/06/light.png ?
My code lies here: https://github.com/doodlemeat/bugfree-octo-sansa