attr.tex_scale and attr.tex_offset in jit.gl.multiple - how to in gl3?

Marco1618's icon

Marco1618

7月 04 2024 | 4:40 午後

I made this patch some time ago; it works with the gl2 graphics engine, but not with gl3.

Basically, I feed a jit.gl.videoplane with a movie, then a jit.gl.multiple creates smaller copies of it, each one showing different portions of the movie.

To that end, I have used the attr.tex_scale_x, attr.tex_scale_y, attr.tex_offset_x, and attr.tex_offset_y as gl params for the jit.gl.multiple, which are no longer supported by the gl3 engine.

I'm wondering, what are the ways to do this in gl3?

Thanks

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

Marco1618's icon

Marco1618

7月 08 2024 | 12:03 午前

Friendly bump. Any jitter ninja willing to help?

Rob Ramirez's icon

Rob Ramirez

7月 08 2024 | 3:22 午後

Unfortunately this technique is no longer available in glcore, and I fully acknowledge a replacement is needed for jit.gl.multiple support, and I hope to come up with something for a future update. The only current workaround involves a custom shader and utilizing the instancing functionality of jit.gl.mesh.

Fortunately, in this particular case, it's not difficult to replicate, and due to the fact that it's implemented using GPU instancing, will be quite efficient (maybe even more so than the gl2 equivalent).

I've modified your patch, and provided a basic shader to demonstrate how it's done, and designed it to be a drop-in replacement for the tex_scale and tex_offset approach in your patch. You can learn more about mesh instancing with jit.gl.buffer by checking out the glcore Examples Extras patch labeled Mesh Instances

A future version of jit.gl.multiple will likely simply provide a kind of 2 plane UV input, and any kind of manipulations will happen using matrix ops or gen on the outside. I'm curious to know your thoughts on this.

Patch and shader attached.

instanced-texcoords.zip
zip


Marco1618's icon

Marco1618

7月 09 2024 | 12:43 午後

Thank you, Rob, I much appreciate your help.

I must admit I still haven’t studied the new glcore functionalities, and I’ve always wanted to learn how to write shaders; this looks like the perfect opportunity.

I’m more of a musician - so take my thoughts with a grain of salt, but I think that for someone without a computer graphic background, it is certainly less intimidating having to deal with matrix ops and the gen family than with shaders (even if one eventually realizes that shading language is not so different from gen for jitter, it’s just more obscure at first).

I’m sorry but I'm not sure what you mean by "2 plane UV input".

Thanks again for showing me your take on my patch.