I'm developing a 2D game in SDL 2.0 and I'm having am trouble with my lighting system. I want to fill the screen with fog and create a transparent circle around the player (lower-left). I know how to make a dark room with a tinted light using SDL_BLENDMODE_MOD (lower-right), but I cannot make the fog. I have tried layering multiple textures over the screen with every combination of SDL_SetRenderDrawBlendMode() and SDL_SetTextureBlendMode() I can think of.
I have searched and found solutions on StackOverflow like this, but they use SDL surfaces and pre-made light images. I am going to be dynamically changing the shape and size of my input image (upper-right) so I need something more flexible.
Solution 1: Instead of a white circle and black background, I use a black circle and navy background. I then blend this using screen blending and get my fog (I've tested this in an image editor to get the lower-left image). Unfortunately, SDL does not have a SDL_BLENDMODE_SCREEN.
Solution 2: Create a semitransparent fog layer and punch a fully-transparent hole in it. Unfortunately, I don't know how to overwrite a texture with a transparent hole. I have tried setting my drawing mode to SDL_BLENDMODE_NONE and drawing a fully-transparent circle, but it only creates fully-opaque ones. The documentation says I can replace the destination alpha but that doesn't seem to work...