How to implement custom blend mode in SDL2?

2.1k views Asked by At

SDL2 provides by default 3 blend modes: alpha blend, additive, and multiply.

However I need to render filled rectangles using the Linear Light blend mode.

Is this possible to implement using OpenGL, or as a combination of the 3 built-in blend modes, or should I convert all my SDL_Textures to SDL_Surfaces and modify the pixel values manually?

1

There are 1 answers

0
AndrewK On

SDL 2.0.6 introduced the function SDL_ComposeCustomBlendMode allowing you to create a new blend mode for 2D rendering.

Here is the doc entry: https://wiki.libsdl.org/SDL_ComposeCustomBlendMode