jit.gl.texture and dstdimstart | dstdimend

hons's icon

i'd like to change only a part of an existing jit.gl.texture and tried doing so by using dstdimstart and dstdimend (and setting usedstdim to 1).

but that does not seem to work.
is there
a) a better / different way to achieve this or
b) am i doing something wrong ?

any help very much appreciated,
thanks a lot,

hannes koecher

here's a testpatch:

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

Rob Ramirez's icon

thanks for the report. i'll take a look.

hons's icon

any news on this one ?

curious,
hannes

lee wang's icon

having the same problem and the same question
1) is dstdimstart and dstdimend not working in jit.gl.texture ?
2) a better / different way to achieve this ?

best,
l.

Rob Ramirez's icon

hi. thanks for bringing this to our attention. it looks like this got broke again with max 6.
i'll get it fixed up for a future update.

you will want to use the message "subtex_matrix" to force jit.gl.texture to use the srd/dstdim attributes.

lee wang's icon

thanks robert for looking at this.
is there a example how to use the subtex_matrix attribute.

my goal is to copy some scaled textures to an output texture
(which has a fixed size)

best,
l.

lee wang's icon

still having a problem with max6 using subtex_matrix of the jit.gl.texture object.
the path, which is posted by hons does not work as expected in max6.

perhaps someone can post a patch which demonstrates how the message "subtex_matrix" works and how we have to use the dstdimstart and dstdimend messages.

thanks in advance,
l.

Rob Ramirez's icon

hons' patch is close, but it needs to use the subtex_matrix message to tell gl.texture to only copy a portion of the matrix (slight discrepancy with jit.matrix in this regard).

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

here's a modified version:

lee wang's icon

hello robert,

thanks for explaining how it works !
perhaps it would be nice to put this somewhere in the documentation ;-)

but i have still a problem, if i change the crop section, some portion of the texture "hangs".
same behavior in max 5 and max 6

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

here is a patch, which demonstrates the error.

Rob Ramirez's icon

well, this isn't really an error. you are telling the texture to draw to only a portion of the rectangle, which it does.
you need to "clear" the texture before sending the subtex_matrix message, perhaps by sending a black matrix to the texture.

lee wang's icon

i think, the main misunderstanding in using dstdimstart and dstdimend is, that we need a named matrix as an input.

i think hons and i thought, that we can crop a texture which the jit.gl.texture object. (which can be the output of an slab also )

perhaps it would be a nice feature in the future.
in the meantime we can use this crop shader:
https://cycling74.com/forums/a-gpu-based-cropper

best,
l.