I have a TextureRect
with a GradientTexture
. I'm trying to get a pixel at a given position. I follow the accepted answer of this question:
var texture_rect = get_node("../TextureRect")
print(texture_rect)
var texture = texture_rect.get_texture()
print(texture)
var data = texture.get_data()
data.lock()
print(data)
print(position, ": ", data.get_pixelv(position).to_html(false))
data.unlock()
I get:
[TextureRect:1141]
[GradientTexture:1135]
[Image:2231]
(447.540558, 218.679306): 000000
even though the color in that position is not 00000. How do I fix this?