0 votes

Hello. I've been trying to create a stereo audio effect based on how many red pixels there are on the screen, with a bias towards the left pixels for the left speaker, and the right pixels for the right speaker. For that, I need to get the red values of each pixel on screen, but I can't figure out how to do so. apparently I need to use lock() after getdata(), but adding it crashes the game and gives the error "Invalid call. Nonexistent function 'getpixel' in base 'Nil'." this is the faulty code in question.

leftamount = (get_viewport().get_texture().get_data().get_pixel(pixelcur.x, pixelcur.y).r) * effectleft
rightamount = (get_viewport().get_texture().get_data().get_pixel(pixelcur.x, pixelcur.y).r) * effectright
Godot version 3.4
in Engine by (29 points)

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.