How to zoom into a texture / jit.gl.layer size / jit.anim.drive units?

Diemo Schwarz's icon

Hi, I want to zoom into a jit.gl.layer at a specific coordinate, not only the centre. I guess I need to combine scaleto and moveto with jit.anim.drive. Would anyone have a patch snippet ready? Otherwise, to calculate this myself I would need to know the size of the texture in the jit.gl.layer (but I can't find how to query this) in units for jit.anim.drive. I read a little about gl units being -1 to 1, but my texture seems to be 2.5 units wide???

Thanks for any pointers!

petcode's icon

Hello,

If you dont want to do the math, you could use a jit.gl.camera (with capture 1)

I wish you much success,

petcode

Pedro Santos's icon

If your camera has a 90 degree lens angle (45º in each direction), it's easier to calculate. Size 1. corresponds to distance 1. Here's an example:

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

Diemo Schwarz's icon

Thanks for the idea, but the zoom has to run in a poly on many instances independently, so the camera thing will be too large of an overhead. No problem to do the math, but I have no idea how to get the size of a jit.gl.layer in gl coordinate space. Empirically, the extent is (-1.25 ... 1.25, -0.75 ... 0.75), but I'd like to know how to obtain these numbers programmatically. Thanks!

Pedro Santos's icon
I want to zoom into a jit.gl.layer at a specific coordinate

Zooming into a jit.gl.layer means doing it in 3d space. Either you move the camera or the layer.

Do you mean to move and scale the texture being shown in the layer? That could be done easily inside a shader or jit.gl.pix.

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