Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Is it possible to pass a list of arrays to a shader Frag

$
0
0

I'm not sure if it's working.
In my frag

#define COUNT 50
uniform int u_pointsCount;
uniform vec2 u_points[COUNT];
float u_circles[COUNT];

void main() {
   //some code before
   for(int i=0;i< u_pointsCount; ++i)
    { 
      u_circles[i] = drawPoly( st, u_points[i], size, 16.);
      
    }
}

In my of App code do i set the values to the array like this?

for (int i = 0; i< 10; i++) {
   shader.setUniform2f("u_points[i]",  ofRandom(1), ofRandom(1) );
}

When i run my app, it draws, but it does not seem to be getting any values from the u_points array.. from what i can tell, it looks like it got back 0,0...


Viewing all articles
Browse latest Browse all 40524

Trending Articles