using srcdim attributes with gl.texture??

terenceformer's icon

Hiya

Quick question here (search isn't working on the site).

I have a video module that takes incoming video, selects a portion of it (cropping, essentially) and outputs it. Previously I was simply using an internal [jit.matrix @usescrdim] and giving it different srcstart/end values.

I've since moved my system into the GPU realm, but I can't figure out how to do this simple operation using [jit.gl.texture]. I don't want to use the subtext method because that means I'd need to go back into the CPU domain at some prior point. The srcdim attributes don't seem to work with g.texture.
Any advice? Thanks a ton!

Letraset Catalogue's icon

I think what you're referring to is in the jit.gl.texture maxhelp. The subtex_matrix tab - dstdimstart and dstdimend

Letraset Catalogue's icon

Oh I see, You need td.rota.jxs

terenceformer's icon

I can't use subtex_matrix because that requires converting the incoming texture back to a jit_matrix, which defeats the point.

I don't want to use td.rota.jxs because its parameters aren't easy to work with. i.e. I'd like to define the region of the incoming video that I'd like to use by describing a rectangle (a la srcdim).

This seems like it should be a trivial operation! Perhaps there is a shader file i'm overlooking that does this? It should really be supported natively with gl.texture.
Hrmph.

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

here's a simple jit.gl.pix based solution to crop textures using pixel parameters:

Letraset Catalogue's icon

That's why I then suggested td.rota.jxs - see the texdisplace folder inside Jitter examples. Saying that, I think Rob Ramirez's jit.gl.pix version will probably be faster.