Before I twist my brain yet another turn:
I am trying to achieve something which seems simple in environments like quartz composer/vdmx and vvvv: corner pin positioning of a quad/plane.
If you take a look at this link there is an example video and also the shader used to create the warp for qc/vdmx: http://www.memo.tv/projection_mapping_quad_warping_with_quartz_composer_vdmx
In vvvv there is the homography module which does the same thing.
I have looked at different keystone examples on the list (particularly jasch and robtherich), but they seem quite complex to achieve a simple corner pinning (and also I would want many instances in my setup).
I have figured out how to capture parts of or the whole gl scene to a texture, and then ideally I would want a shader based on the code from the link above:
uniform vec2 BL, BR, TL, TR;
uniform vec2 renderSize;
void main() {
// transform from QC object coords to 0...1
vec2 p = (vec2(gl_Vertex.x, gl_Vertex.y) + 1.) * 0.5;
// interpolate bottom edge x coordinate
vec2 x1 = mix(BL, BR, p.x);
// interpolate top edge x coordinate
vec2 x2 = mix(TL, TR, p.x);
// interpolate y position
p = mix(x1, x2, p.y);
// transform from 0...1 to QC screen coords
p = (p - 0.5) * renderSize;
gl_Position = gl_ModelViewProjectionMatrix * vec4(p, 0, 1);
gl_FrontColor = gl_Color;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
I have so far not been able to get this shader code to work in jitter, I haven´t worked with vertex shaders before, and haven´t found any similar types of shaders to point me in the right direction.
So if someone wants to help me out, or point to some good examples, or explain why this wouldn´t work at all, that would be great!
Another related question from a earlier post by fp which has been left unanswered:
he had made a simple patch where a video texture was sent to a jit.gl.sketch object. When used with the plane command it worked fine, but when trying to use a quad (which would do what I am looking for) the texture disappears.
So why doesn´t quad like the texture?
Here is the link to that thread (patch is the last post in the thread:
http://www.cycling74.com/forums/index.php?t=msg&rid=0&S=d3700dd9c5aa4636cd29fced1d3230b8&th=34641&goto=147027#msg_147027
thanks,
hc