jit.gl.videoplane autoscaling to canvas resolution
I'm having issues with jit.gl.videoplane automatically scaling a transparent png file to the native resolution of the jit.world.
Eg. - I'm reading a file of 722x638 resolution, but it doesn't render at that size; it is automatically rendered significantly bigger, and I have to try to manually scale it down (scale is originally shown as 1. 1. 1., but the image appears much larger).
I've looked at transform reset and preserve aspect ratio but with no joy.
Can anyone help?
hi,
Try scaling the videoplane according to the aspect ratio of the image:
Hi, thanks for your reply.
I've made a patch based on yours illustrating my issues.
So, in my case I need my jit.world to be 3840x2160, and I'm just trying to show a movie or PNG file which is 722x638 at the PNG or movies orignal size (i.e. it will only take up a fraction of the screen). Using your patch I still get the original problem.
When I use jit.matrix and jit.matrixinfo it shows that it's 782x638, but at some point my image is getting scaled up to the resolutions of my jit.world.
I've played around with pretty much every setting of the videoplane but am really stuck with this.
Ah, ok, I didn't get the final output was supposed to be of a different size.
Then I guess you'll have to consider, together with the aspect ratio, also the ratio between the vertical dimension of your picture and the vertical dimension of the rendering window:
Something like this?
From what I understand you want to display a smaller image over a big jit.world.
Quick suggestion: try to use jit.gl.cornerpin to resize and dispose your png. (And note that size is not an attribute of jit.movie)
Hi Riccardo - Thanks for your reply. I'm curious: how would jit.gl.cornerpin be different from using scale and position attributes of jit.gl.videoplane?
jit.gl.cornerpin is undoubtedly an excellent tool for placing/resizing/distorting an image in the gl context and something worth exploring that can get the job done.
For your needs, maybe it's a bit overkill because the definition of the positioning and scaling is done by providing the spatial coordinates of the 4 corners; therefore, if you need exact scaling, you still have to go through ratios and stuff. Besides, it's a bit slower than a "flat" videoplane because it compensates for affine transformation issues behind the curtains.
(see here for more details: https://stackoverflow.com/questions/12414708/correct-glsl-affine-texture-mapping)
HI, surely you can get the same results by scaling and positioning a videoplane, but I remember that some years ago I had a similar problem: In a show I had to project a large series of slides (all with different sizes and orientation, without changing its size ) over some SD movies (in those days it was the highest resolution ;-) and jit.gl.cornerpin @preserve aspect 1 saved my day.....
Afterwards I'm certainly not able to go so deeply into openGl as Matteo (btw Ciao Matteo!)
Thanks both for your explanations - I was sort of fudging it in a laborious way before.
@ Matteo - what you did there works great, and I've incorporated a bit a querying of resolutions to make it automatic.
It's made it clearer what the relationship between videoplane, jit.world and jit.movie is - will come in handy for sure.