using srcdim attributes with gl.texture??

Feb 7, 2014 at 12:28pm

using srcdim attributes with gl.texture??


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 []. 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!

Feb 7, 2014 at 1:20pm

I think what you’re referring to is in the maxhelp. The subtex_matrix tab – dstdimstart and dstdimend

Feb 7, 2014 at 1:31pm

Oh I see, You need td.rota.jxs

Feb 7, 2014 at 3:09pm

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.

Feb 7, 2014 at 3:36pm

here’s a simple based solution to crop textures using pixel parameters:


– Pasted Max Patch, click to expand. –


Feb 8, 2014 at 4:19am

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


You must be logged in to reply to this topic.