Screen capture on Android not working in Godot 3.0.6 ?

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

Hello,

Is screen capture not working in Godot 3.0.6 ?
I dont want to upgrade to 3.1 yet as there seems to be a lot of tweak necessary…

I am speaking on Android since in Linux i is working fine, but on Android this method is returning NULL:

var img = get_viewport().get_texture().get_data()

According to this thread it should be solved (dates back to Nov 2018)

As described in the thread, the problem in this call : get_viewport().get_texture().get_data() is the get_data() part.

On Android, i can call get_viewport().get_texture() and set the texture successfully on a mesh with the following code:

var retTexture = GetScreengrabAsTexture()	//just executing : return get_viewport().get_texture()

#testing setting screen grab to floor
curScene.get_node( myNode ).get_surface_material(0).albedo_texture = retTexture
var img = curScene.get_node( myNode ).get_surface_material(0).albedo_texture.get_data()
img.flip_y()

with the image line var img=... failing. Since i am able to make sure the screen grab worked (displays correctly on the mesh) any hack to get the image somehow from it?
I know this is not the optimized way to get a screengrab, but it works for me in case possible…

I tried using, .duplicate(true) on the texture but not to avail…

GameVisitor | 2019-04-25 08:03