Change alpha at a specific point on a texture

I want to create a nice lighting effect and I was wondering if it’s possible to change the alpha at a specific point on a texture.
My idea is that I create a black texture that fits the entire screen, I then change the alpha at any place there is light on the screen and then render the texture over everything.

Does anyone have an idea how I’d do this?

Changing a texture once it’s been rendered will have no effect on the scene.

Or do you mean you’re going to re-render the scene after you’ve changed the alpha values?

I want to change the black texture before I render it over everything.
My idea being I want to create the black texture, then edit the alpha wherever there is light and then render the result over everything

Create a streaming texture.
Modify it using SDL_LockTexture/UnlockTexture.
Render it over top of your scene.

Be aware that this can be slow, depending on how big the texture is. Will probably be faster to set it as the render target and then draw on it with the various SDL drawing functions, then switch back to the default render target and draw your texture over the scene. This will still have an impact on fill rate.

Once you start needing to do complex FX and such, you’re kind of out of the purview of SDL Renderer and start to need to do your own rendering.

You can also use a Render Target texture, which is generally easier to work with than a streaming texture at the cost of taking up more GPU resources.