0 votes


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)

in Engine by (849 points)

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()

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..

Please log in or register to answer this question.

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 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.