Hello, See the new version attached to use a texture. ++
Jack Le 05/08/2018 à 01:28, oliver a écrit : > cyrille henry wrote: >> hello, >> >> you can try [curve3d] > > cyrille, jack: thanks a lot for your kind help. > > i tried both your suggestions with some success , but i'm not quite > there yet. > > > > i attached an example patch providing both methods and problems. > > > basically [curve3d] works well, with a minor issue that can be worked > around. though i don't understand why it's there. > > the issue is that the applied texture is rotated by 90°. i tried several > things to correct it ([pix_flip], [pix_coordinate]) but they all messed > up the texture. > > ======================================================================== > > the vertex-shader approach of jack produces the shape i was looking for, > but unfortunately doesn't allow texture mapping. or at least i wasn't > able to figure out how to do it. > > thanks for any further thoughts ... > > best > > oliver > > > _______________________________________________ > [email protected] mailing list > UNSUBSCRIBE and account-management -> > https://lists.puredata.info/listinfo/pd-list >
mesh_deformation.pd
Description: application/extension-pd
uniform sampler2D tex0;
varying vec4 vertColor;
void main() {
vec4 image = texture2D(tex0, gl_TexCoord[0].st);
gl_FragColor = image * vertColor;
}#define PI 3.1415926535897932384626433832795
uniform float deformation;
varying vec4 vertColor;
void main() {
vertColor = gl_Color;
gl_TexCoord[0] = gl_MultiTexCoord0;
vec4 pos_vertex = gl_Vertex;
float add_y = cos(pos_vertex.x * PI * 0.5) * deformation * pos_vertex.y;
pos_vertex.y += add_y;
gl_Position = gl_ModelViewProjectionMatrix * pos_vertex;
}_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
