I'd like to load the shader code of "vertexshaderart.com" into oF and port it

Vertexshaderart.com
I would like to transplant shader code on this site to oF,

Vertexshaderart has so many inputs.

Attribute float vertexId;
Uniform float vertexCount;
Uniform vec2 resolution;
Uniform vec2 mouse;
Uniform sampler 2D touch;
Uniform float time;
Uniform sampler 2D sound;
Uniform sampler 2D floatSound;
Uniform vec2 soundRes;
Uniform vec4 background;

How do you port “vertexId” and “sound” to openFrameworks?
In addition, sound is texture data, but is it necessary to convert it to fft?

you can use attribute variable for vertex id something like,

float _verticesId[ your_num_vertices ];
for (int i = 0; i < your_num_vertices; i++)
    _verticesId[i] = (float)i;
GLint _vertexId = shader.getAttributeLocation("vertexId");
glEnableVertexAttribArray(_vertexId);
glVertexAttribPointer(_vertexId, 1, GL_FLOAT, 0, 0, _verticesId);

for the sound texture, store sound date into texture is different issue with fft. you may need to use fft to analyze sound based on frequency, you may need to store those values into texture by using attribute. I’m not an expert on sound, I hope someone else would shed some light on here.

1 Like