jit.gl.videoplane scale and position issues

Jan 3, 2011 at 12:40am

jit.gl.videoplane scale and position issues

I know I am missing something fundamental. I have been banging my head against a wall and I don’t seem to be able to find the answer…

I use jit.gl.videoplane to display a picture (eventually video). Fine so far.
I then cut out a piece of the original jit.matrix using “srcdim” end “dstdim” and store that in a new matrix of the new size. Also fine.

I now put that small cutout into a jit.gl.videoplane and display it on top of the original videoplane. I would like it to be at the exact position and scale of the original so that initially no one can tell there is an overlay happening. This way I can gradually change certain aspects of the picture and rearrange them as well later on.

This is where I lose it. I have exact coordinates of the cutout but in screencoordinates. I use jit.gl.render (bound to my context) to convert this to world coordinates. I guess that’s fine too. The scale however I am lost with.

I am attaching what I have so far. If someone could have a look and give me some pointers, maybe refer me to some tuts I overlooked. I am really lost right now and any help will be greatly appreciated!!!

Thanks in advance.

– Pasted Max Patch, click to expand. –
Jan 4, 2011 at 7:54pm

you might want to try the orthographic projection (@ortho 1 or 2 on your gl.render).
you can also try @transform_reset 1 or 2 on your gl.videoplanes.

Jan 4, 2011 at 8:08pm

thanks. the ortho 2 message was very helpful.
I figured out how to do the scaling. was much easier than I thought. but the translation from screen to world coordinates for the location of my rect still bothers me.
What I do right now is calculate the center of my rect, then use “screentoworld $1 $2″ to get it converted. Unfortunately, what I get out of it isn’t even close to where the rect should be.
Am I missing a crucial step here?

apologies, but gl is self-thought and that has been a while. I didn’t use it, now I lost it :(

Thanks for any insights.

Jan 6, 2011 at 9:51pm

can you post a very simple example of your problem?

Jan 8, 2011 at 7:47pm

I tried to isolate the problem, and wouldn’t you know, when I simplify it it goes away!!! driving me bonkers because I still can’t see how my main patch is different. Well, gonna go bug hunting for the weekend I guess :(

thanks for your help


You must be logged in to reply to this topic.