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

Thanks for your reply.
I'm looking at the textureBufferInstancedExample but i don't really
understand how to use it.

For my project i would need more than 16.

Let me try to figure out what i should be doing, I need a
vector<ofMatrix4x4> matrices; which i use to store my list of
points? Depending on how many points i have, i do a
matrices.resize(noOfPoints); on update.

In my update method, i then set the points xy, info i want to pass to
shader, on the martices by using a loop

for(size_t i=0;i<matrices.size();i++){
   matrices[i] = pointsData; //?? How do use this exactly??
}

Not familiar with using matrices, i just need to pass in 2 values per
point. Don't really understand the ofMatrix4x4 documentation. Is it like
so?

for(size_t i=0;i<matrices.size();i++){
   ofMatrix4x4 tempMat = ofMatrix4x4 ( myPoint.x, myPoint.y, 
0,0,0,0,0,0,0,0,0,0,0,0,0,0 );
   matrices[i] = tempMat =; //Is this right?
}

Do i next run the buffer.updateData(0,matrices); method?

Also how do i access the matrices info from the frag shader? I only see
it in the vertex shader.
Can i put this in the frag shader uniform mat4
modelViewProjectionMatrix;
? or do i get it from the tex?

Thanks!


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>