Weird and confusing resizing issue using Jitter

Christien Ayers's icon

In my patch, I'm trying to set up a chain of Jitter objects such that I can dynamically resize the dimensions of a jit.movie object and display it in jit.world.

Things I've tried and the issues that I'm having:

Connecting a [jit.movie @output_texture 1] object to a [jit.gl.videoplane] and changing the videoplane's dimensions has no effect on the texture dimensions displayed in the jit.world context.

Storing the [jit.movie @output_texture 1] object's outgoing texture into a [jit.gl.texture] object, and altering the texture object's dimensions also doesn't work how I want. The displayed movie changes but either the vertical or horizontal side of the video always stretches to fit the jit.world window, depending on what the [jit.gl.texture] dimensions are.

Essentially, I want to achieve the result that the scale attribute of [jit.gl.videoplane] gives, while also causing the dimensions of the outgoing texture to change as a consequence. Down the line, my patch will analyze the number of pixels in the texture (via multiplying the texture dimensions together) in order to effect audio in some arbitrary way, so I need for the dimensions themselves to be accurate to what is displayed in the jit.world context. I feel like I'm missing something but I can't quite figure it out.

I've attached a patch to provide further clarity. I'd appreciate any help, thanks!

jitter-resize-issue.maxpat
Max Patch

TFL's icon

Answer: get the dim of your texture, and set the jit.world's size (window size) and dimension (dimension of its internal output texture) to the same value.

Max Patch
Copy patch and select New From Clipboard in Max.

You can even avoid jit.gl.videoplane and directly connect the output of your jit.gl.texture to jit.world.

As a side note, the dim of a jit.gl.videoplane is actually the number of vertices it contains. Think of the videoplane as a plane mesh on which you apply your texture. A videoplane of dim 20 20 has 20x20=400 vertices, but this has nothing to do with the dimension of the texture you apply on it.

Christien Ayers's icon

Thank you—but is there a way to do this without having to change the size of the window? I'm assuming I can plug the texture into some sort of container like jit.gl.videoplane but that hasn't worked thus far, so it may be the wrong object.

And thanks for that tidbit on how jit.gl.videoplane actually works! Makes a lot of sense.

TFL's icon

Oh my bad! Try this instead:

Max Patch
Copy patch and select New From Clipboard in Max.

Re-reading this again

Essentially, I want to achieve the result that the scale attribute of [jit.gl.videoplane] gives, while also causing the dimensions of the outgoing texture to change as a consequence. Down the line, my patch will analyze the number of pixels in the texture (via multiplying the texture dimensions together) in order to effect audio in some arbitrary way, so I need for the dimensions themselves to be accurate to what is displayed in the jit.world context.

and I feel like you might have easier ways to achieve what you want, although I don't 100% understand your end goal.

Christien Ayers's icon

Thank you, this works great!

I'll explain my goal in greater depth if that'll help reach an easier solution—though I think your solution is the most efficient, unless there's an object that does what I'm looking for.

I'm making a sonification patch where the user can load videos into [jit.movie~] objects, and the ways in which they choose to manipulate a particular video affects the sound of the audio track output by its corresponding [jit.movie~]. The videos will all be displayed in a [jit.world] context, with the [jit.world] object acting as a container for these videos to move around within. Right now, a texture is output from [jit.movie~] and fed into a [jit.matrix] object which is fed into a chain of objects that perform analysis on the matrix (in order to affect the audio track). So it's important for the dimensions to be accurate to what the user sees in the [jit.world] window because the [jit.matrix] grabs its dimensions from the [jit.movie~] texture, which affects everything else.