How can I perform a masked erase in SDL2?
- by Kvisle
I'm trying to implement some shadow/lighting effects in my 2D-project, and I've concluded that if there is an easy way to perform a masked erase on an SDL_Texture, it would make the drawing operations quite cheap.
Let's say I have a texture of the part of the level where light is not meant to be rendered.
I also have a texture with my "light map"; I want to use this to just draw omni lights from my light sources.
Then I want to use the first image to 'subtract' the portions of the light map that are not to be rendered on the final scene.
Then I draw my "light map" texture on top of my scene, with additive blending enabled.
This sounds like a good theory in my head, but I can't see any functions in the SDL2 API that let me do masked erase from a texture.
Am I overlooking something? Does anything like this exist?