_draw function am I doing someting wrong ?

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

func _ready():
	pass # Replace with function body.


func _draw():
	draw_rect(Rect2(Vector2(0,0),Vector2(25,480)), Color("003366"), true)
	draw_rect(Rect2(Vector2(295,0),Vector2(25,480)), Color("003366"), true)
	draw_rect(Rect2(Vector2(25,0),Vector2(5,480)), Color(255, 255, 0), true)
	draw_rect(Rect2(Vector2(30,0),Vector2(5,480)), Color(255, 255, 255), true)
	draw_rect(Rect2(Vector2(285,0),Vector2(5,480)), Color(255, 255, 255), true)
	draw_rect(Rect2(Vector2(290,0),Vector2(5,480)), Color(255, 255, 0), true)
	
	
	draw_rect(Rect2(Vector2(0,0),Vector2(360,30)), Color(0,0,0),true)
	draw_rect(Rect2(Vector2(0,30),Vector2(360,5)), Color(0,0,0,0.4),true)

why is the yellow and white rect is drawn on the top of the transparent black?
ScreenShot
this is a test project with just a Node2D and a script attached to it.

:bust_in_silhouette: Reply From: estebanmolca

I don’t understand very well how godot mixes the colors, but it behaves in this way when the viewport is used for 3d. With this line in the _ready function: get_viewport ().usage = Viewport.USAGE_2D the colors are mixed as expected. If you don’t want to put your main viewport in 2d, you can create another one with 2d enabled.

Thank you so much !!!
so following your guidance I ended up changing intended usage under Project Settings >General>Rendering>Quality from 3D to 2D and it worked like charm. I would like to understand why but at least now it work.

igbow | 2020-01-10 05:26