How to create glsl inputs

hello! i want to create some vertex shaders input, to send data per vertex. I dont know exactly how can i do it. im sure that some of you have this information. Actually my shaders inputs are texCoord, Color, position, normal… but i need to send more information (actually now im using the fill() method to send data color but not with that propose, just to get the number, i want to create a separe input)

1 Like

Hi! What you are looking for is called “custom attributes”. texCoord, color, position and normal are the attributes that Processing sets using methods like fill(). You can do that definitely with low level opengl, but I don’t know if it’s possible otherwise.
In https://processing.github.io/processing-javadocs/core/ you can see a bunch of methods dealing with attributes. Maybe you can find examples online or in the previous forum? Here a similar question but without answer: https://forum.processing.org/two/discussion/18688/how-does-the-point-shader-work-with-custom-attributes

Update: maybe the PShape.attrib() method does the trick? There’s no examples, but you can try…

BTW. In my last project I did your same trick: send unrelated data in the normals attribute. I had no time to figure out if there was a better way.

2 Likes