+2 votes

This damn code doesn't work on Android but works fine on Windows.
Any ideas ? thanks !

extends Node2D

func _ready():
var img_name = load('bk.jpg').get_data()    
var imgt = ImageTexture.new()   
var mRect2 = Rect2(0,0, 500,500)    
imgt.create_from_image(img_name.get_rect(mRect2))   
var temp = Sprite.new()
temp.set_texture(imgt)
add_child(temp)
in Engine by (528 points)

1 Answer

+3 votes
Best answer

See #2997 on github, it seems like a limitation of gles2 (can't get texture data once it's on the gpu, so get_data() returns an empty image).
The upcoming gles3 renderer will probably fix this.

by (924 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.