Draw alpha rect

Hi,
some one can give me a example of how to draw a semi-transparenty rect?
I had tried like:

  SDL_SetRenderDraw(Color(renderer, 255,0,0,128);
  SDL_RenderFillRect(renderer);

But, the result rect is always solid.
So, I need change my render settings to fill transparenty rects? How do it?

Did you call SDL_SetRenderDrawBlendMode()? The default mode is SDL_BLENDMODE_NONE which will result in the behavior you observed.

1 Like

I don’t know about the blend mode, thanks.
Must I call it before fill rect or just once time after init the renderer?
I will try search for some example.

Just once (unless you need to change it subsequently).

Ok man, thank you again, solved!

1 Like