draw_rect color stuck as white

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By droc101

I am using draw_line to draw a line across the screen. The color of the line, although fed Color.black, draws as white.
Code:

export (Color) var window_color : Color = Color8(0, 0, 0, 255)

for i in 128:
		draw_rect(Rect2(Vector2(window_1_memory[i*2], i), Vector2(window_1_memory[i*2 + 1], 1.0)), window_color, true)

According to the title and the script you’re drawing a rectangle. According to the accompanying text you’re drawing a line. What is it?

The color of the line, although fed Color.black, draws as white.

I cannot reproduce this, here’s my code and it’s running fine:

export (Color) var window_color : Color = Color8(0, 0, 0, 255)

func _draw():
	 draw_rect(Rect2(Vector2(0, 0), Vector2(200, 200)), window_color)

njamster | 2020-03-25 14:36

Well before I run that code, I’m drawing 4 other textures, and line by line changing the offset… Maybe it can’t be done in one frame?

droc101 | 2020-03-25 14:40

:bust_in_silhouette: Reply From: PaintMeteor

You may be using a shader material, which affects the color of the shape that you drew.

1 Like