Possible to give letters in jit.gl.text (3d/2d) a separate color?


    Aug 18 2018 | 9:53 am
    Hey all!
    I'm looking for a way to give every letter of a jit.gl.text3d a different color. I am outputting the matrix of the jit.gl.text3d to a jit.gl.mesh to work from there with color and draw_modes. I have tried giving it a texture, but can not find a way to map the texture on the entire text (instead of repeatedly on every single letter). Other tex_map modes also don't give the result i'm hoping for. I also tried the jit.gl.mesh color array inlet, but i can not find a way to figure out how many vertices every letter has so i can give them separate colors. If i set the jit.gl.mesh to auto_colors 1 i get somewhat the result i'm hoping to get when using a texture. I included some pictures to show what i mean. Any help/suggestions are welcome.
    Thanks a lot!

    • Aug 19 2018 | 10:59 am
      Came to this solution at the moment. So for now it is working! But with a large textfile the framerate drops insane.
      So apparently jit.gl.text rapidly outputs a matrix for every letter that has to be drawn (when matrixoutput is enabled). If you select a different color for every of those matrices you give every letter a new color within 1 frame render.
    • Aug 20 2018 | 6:34 pm
      hi Timo, thanks for sharing your patch.
      this is something that I have started piecing together a design for, an object that allows for jit.gl.multiple functionality with a jit.gl.text object's letters / words / lines. nothing has been implemented yet, but it's on the back burner.
      I think your best bet for efficiency is to pre-process by loading your file with gl.text, outputing the matrices, concatenating them together into a single matrix, duplicating those matrix dims for your color matrix, and then sending to the gl.mesh.
      maybe that gives you some more ideas to play with.
    • Aug 20 2018 | 6:52 pm
      here's a basic example of the technique described above:
    • Aug 20 2018 | 9:41 pm
      Hi Rob! Thanks for your reply. Concatenating the matrices seems like a good idea indeed! Thanks for your patch.