How many jit.gl.texture objects
Feb 22 2021 | 9:29 am
Hi! Supposing I have many spheres (jit.gl.gridshape) on the scene and I want to write index numbers on the surfaces of most of them. Is it necessary to dedicate a separate jit.gl.texture object for each numbered sphere or is there a workaround?
- Feb 22 2021 | 3:06 pmyou can create a "textue atlas" with all the numbers and then use tex_map 1 and tex_plane_s/t to map them.unfortunately the tex_plane_s/t use is archaic and not intuitive, but it works. you can even use it with jit.gl.multiple.use this snippet to make things slightly more intuitive:
- Feb 22 2021 | 3:12 pmhere's a very old patch i made that uses the above technique with jit.gl.multiple to map key object output to locations in a font atlas using tex_plane_s/t.in this case the math takes into account the characters in the font atlas are 16 x 16, but that's about the only hint i can give to how the jit.expr math works.
- Feb 22 2021 | 4:06 pmThat's a fantastic patch, thank you.About jit.gl.multiple: I'm trying to include user interaction and make all shapes selectable by mouse to get the individual object "name"s from jit.gl.picker, so I think I cannot use jit.gl.multiple for that but I have to create shapes individually. I'm not experienced in Jitter so I have to ask with apologies: if this is adaptable to use without jit.gl.multiple (for the purpose I explained), can you give other hints in that direction?
- Feb 22 2021 | 7:26 pmIMO the best solution for mouse picking with gl.multiple is to use some jit.phys objects for this (phys.multiple phys.picker) in conjunction with the gl.multiple.if desired, you can set @dynamics 0 on your jit.phys.world to so that you are only using the collisions functionality of the physics simulation.search the file browser for phys.multiple.picking.maxpat for an example of using phys.picker with phys.multiple for mouse picking
- Feb 22 2021 | 7:31 pmhere's a modified version of that example patch that removes dynamics and simplifies the setup a bit: