Hi!
Is there a way to pass an array of data to vertex shader?
thanks!
Ivan, this is outside my domain of expertise. @sven or @Ragnar_Svensson, could you please answer this one?
How large of array data do you need to send?
let’s say 100 floats
so far I use
uniform mediump vec4 data1;
…
uniform mediump vec4 data26;
…
float height [101];
height[0] = data1.x; height[1] = data1.y; height[2] = data1.z; height[3] = data1.w;
...
int idx = int(position.x);
and then I use idx to get value
it works, but not in webgl
in a theory, I can use texture for this. but not sure if texture fetch will work in vertex shader on mobile or web.
Here is the result so far:
The way you are doing it may be the best way to do so right now. I tested sending array type table data just to make sure but set_constant expect vector4s only. You should create a feature request for adding array data types via table data for passing array data to shaders.
Created a feature request: DEF-2055
Any updates on this request?