Hello! im trying to “deform” or “rig” a cylinder shape create in Processing and send it to vertex Shader:
here the piece of code that generate the shape:
int rr = 50;
int h = 1000;
int vertices = 25;
beginShape(TRIANGLE_STRIP);
for (int i = 0; i <= vertices; i++) {
float angle = TWO_PI / vertices;
float x = sin(i * angle);
float z = cos(i * angle);
float u = float(i) / vertices;
vertex(x * rr, -h/2, z * rr);
vertex(x * rr, +h/2, z * rr);
}
endShape();
here my default vertex:
#version 150
#define PROCESSING_COLOR_SHADER
#ifdef GL_ES
precision mediump float;
#endif
in vec4 position;
in vec3 color;
out vec3 Color;
uniform mat4 transform;
in vec2 texCoord;
out vec2 TexCoord;
in vec4 normal;
uniform float u_time;
uniform mat3 normalMatrix;
void main() {
vec4 pos = position;
TexCoord = texCoord;
Color = color;
gl_Position = transform * pos;
}
and here the result:
[ATTACH=CONFIG]1817[/ATTACH]
what i want is try to put the shape into some kind of “spline”, or something like a ray, just something like that:
[ATTACH=CONFIG]1818[/ATTACH]
how can i “bend” geometry to generate that points of intersection? i assume is something that i can do in vertexShader, but maybe im wrong. thanks a lot