draw_set_alpha seems to not work with draw_rectangle

453 views Asked by At

MY GOAL: I'm trying to draw a transparent black rectangle over the current view.

THE PROBLEM: No matter what alpha I set, the rectangle is drawn with full opacity.

THINGS THAT I'VE TRIED:

  1. I tried changing the color of the rectangle to make sure that I'm looking in the correct part of the code. (The opaque rectangle's color changed, leading me to believe that this is the correct spot in the code.)
  2. I tried removing this call to draw_rectangle_color() to make sure that I'm looking in the correct part of the code. (The rectangle stopped being drawn, leading me to believe that this is the correct spot in the code.)
  3. I tried doing draw_set_alpha(0) immediately before drawing the rectangle, but it was still drawn with full opacity.
  4. I tried also doing image_alpha = 0 immediately before drawing the rectangle, but it was still drawn with full opacity. (didn't expect this to work, but it was worth a shot)
var rectColor = c_black;
var rectAlpha = 0.2;

draw_set_alpha(rectAlpha);
draw_rectangle_color(viewX, viewY, viewX+viewW, viewY+viewH, 
                     rectColor,rectColor,rectColor,rectColor,
                     false);
draw_set_alpha(1);
1

There are 1 answers

0
Kellen Kincaid On

FIXED I was using a shader that was overwriting the alpha to be 1.

draw_set_alpha() works properly with draw_rectangle_color()

:)