@ayruos wrote:
Hello! Doing some work with shaders and trying to figure how to send an attribute to the vertex shader. They’re being loaded from file and a mesh is being drawn so I have this at the moment…
void ofApp::setup{ shader.load("filename"); } void ofApp::update(){ fbo.begin(); ofClear(0, 0); shader.begin(); //a bunch of uniforms being sent here mesh.draw(); shader.end(); fbo.end(); } void ofApp::draw(){ fbo.draw(0, 0); }
The mesh is being calculated/updated as a separate function, everything works fine, but for the vertex shader I want to send the index of each vertex (and the size of the mesh, but that’s a uniform) to be able to have some different functions depending on whether the vertex is at the beginning or end of the mesh.
I’m very confused about how to use the
void ofShader::setAttribute1f(GLint location, float v1)
function to send the index as an attribute.I hope someone can point me in the right direction. Thanks!
Posts: 1
Participants: 1