glsl - Passing QML Array to ShaderEffect -


i try render grid different colors each field, depending on input. in imagination suitable input array:

property var fields: [0, 1, 0, 1, 0, 1, 0, 1, 0] 

might appropriate describe 3x3 (colorful) chess board.

the corresponding shadereffect this:

shadereffect {     width: 600     height: 600     property var fields: [0, 1, 0, 1, 0, 1, 0, 1, 0]      fragmentshader: "         varying highp vec2 qt_texcoord0;         uniform highp int fields[9];          void main() {             highp int field = int(floor(qt_texcoord0.x * 3.0) + (floor(qt_texcoord0.y * 3.0) * 3.0));             gl_fragcolor = vec4(fields[field], field / 9.0, 0.0, 1.0);         }     " } 

but value fields[field] seems 0 though field proven not be.

how can array working in shader? have it, access wrong?


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -