I’ve spent the last two days trying to implement this: http://forum.openframeworks.cc/index.php/topic,3121.msg23803.html#msg23803
inside of Unity. I’ve got it so I’m 99% sure I’m calculating the homography matrix correctly for my quad transform. My issue is that my homography matrix does not seem to be affecting the object properly- it skews my object improperly.
edit: made it work. winning code as follows. just need to figure out how to pass my transformedMatrix into a shader, while still doing the LoadPixelMatrix equivalent in a shader…
edit: to do the same thing as GL.MultMatrix in GLSL , if i have an ortho camera and my quad is setup to be positioned at the 4 corners of my screen, i can pass my homography matrix (WarpMatrix) in to my vertex program, and do
gl_Position = gl_ModelViewProjectionMatrix * WarpMatrix * gl_Vertex;
that was easy!
GL.PushMatrix();
mat.SetPass(0);
GL.Color(new Color(1,1,1,1));
GL.LoadPixelMatrix();
GL.MultMatrix(transformedMatrix);
GL.Begin (GL.QUADS);
GL.TexCoord (new Vector3(0, 0, 0)); GL.Vertex3 (src[0].x, src[0].y, 0);
GL.TexCoord (new Vector3(0, 1, 0)); GL.Vertex3 (src[1].x, src[1].y, 0);
GL.TexCoord (new Vector3(1, 1, 0)); GL.Vertex3 (src[2].x, src[2].y, 0);
GL.TexCoord (new Vector3(1, 0, 0));GL.Vertex3 (src[3].x, src[3].y, 0);
GL.End ();
GL.PopMatrix();