Shader Calculation

I’d like the vertex shader to calculate something for me. The number of output vertices is the same as the number of input vertices, but the number of input vertices can vary, is not constant. I’d need a variable array in the shader, but there is none. Nevertheless, maybe there is some tweak?

The vertex shader runs once and once only per vertex, and does not have access to any vertex other than the one it is currently running on.

Can you clarify that the latter is your requirement before I comment further, please?

take a look at shader storage buffer
generate a buffer object, allocate some space for it, fill it with some data, bind it to a “shader storage block”, then you can access an “unsized array”, the size depends on the buffer objects size. read also about the memory layout “std430”

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.