Novice problems using jit.gl.text to create a vertically scrolling text stream


    Jun 21 2016 | 12:25 am
    Hi Forum,
    Where I am having great difficulty is where I want to accumulate each of the text messages that arrive and present them in another jit.window and have them begin a new line and start vertically scrolling as they begin to shift off the window. My problem is that each time a new message arrives from the web, it populates a message box and erases the previous message.
    I have tried to use the coll object to store each new message and append it the the previous one but I cannot get that to work at all due to inexperience and lack of knowledge. I would really appreciate any help with this issue and sorry for the long winded post.
    The code below does not have the web message stuff but if needed, I can attach that version. Many thanks in advance for any help.
    John.

    • Jun 21 2016 | 3:56 pm
      hi John.
      in my opinion, the best way to handle dynamic multi-line text with jit.gl.text is to use matrices to store the text. jit.gl.text will interpret each row of a 1 plane char matrix as a new line. you can dynamically append lines of text to a matrix using jit.matrix attributes (dstdimstart and dstdimend) and the jit.str.fromsymbol object to convert the text into a matrix.
      there are different ways to handle resizing the matrix based on line length and number of lines, but for starters the easiest way is to simply start with a large enough matrix. e.g. [ jit.matrix 1 char 50 100 ] will allow for lines up to 50 chars in length, and will store 100 lines.
      below is a patch to get you started. it uses a simple text object to simulate your lines of text from the web. hope this helps.
    • Jun 21 2016 | 4:30 pm
      Hi Rob,
      Thank you very much for your reply. This is a great help including the explanation. I know I will have problems getting the text from the web message box but I will experiment with routing it through a coll or text object as the source. I will experiment with the solution you have provided and report back. Thanks again Rob.
      I appreciate your help with this.
      John.
    • Jul 02 2016 | 2:05 am
      Hi Again,
      @Rob Ramirez I am working with the code example above that you kindly shared. I understand what is happening in the patch and I almost have it working in my own. My problem is that the text that I receive from my web app is behaving very strangely in the jitter matrix and I cannot figure out why. Here's what's happening:
      When I send the message from the web app it arrives into a message object in Max which is connected to the jitter matrix and then to the jit.gl.text object. If i receive a message saying " sending test message from web" the first time it receives the message it only displays the first letter which in this example would be 's'. If i click the message box that contains the proper message (with my mouse) the proper message will display. Every subsequent test message will then appear but it displays incorrectly e.g. "sssendin ts mmmsge rmwb".
      I don't think it has anything to do with the web app as I am sending the same message to another jit.gl.text object and it displays perfectly. I have attached my patch and would appreciate if you or somebody else could take a look and let me know what the problem might be.
      Apologies for the big untidy patch, it is still under development and thanks in advance for any help.
      Kind Regards.
      John.
    • Jul 03 2016 | 8:44 pm
      Hi John. I think we chatted a bit on fb when you had some questions about this topic. At that time I made this patch. Maybe it has some helpful clues. I think I came across a similar problem when doinf this up. Unfortunately I can't open your patch as I don't have Java installed, also I'm working to a deadline so a bit pressed for time. Here's the patch I made though. Hopefully it's helpful.
      Simon
    • Jul 04 2016 | 1:59 pm
      Hi Simon,
      Thanks for your help on this forum and on FB. I used your code/patch above and it is working very well for me now. Many many thanks for taking time out to help me.
      I was using Robs patch above that uses jit.gl.text with jit.gl.fromsymbol and it was working except it was displaying the text sent from the web incorrectly/glitchy. I don't know if it is a problem with my patch or if it is related to this bug which has been addressed in the latest update:here .
      @Rob if you want to reproduce the problem I was having (to check for a bug) you would need the external installed: here
      Once again thanks guys for the help. This forum and the FB page are excellent resources for getting educated in all things Max/MSP/Jitter etc. Hopefully I can contribute some advice in the future.
      John.
    • Jul 05 2016 | 3:48 pm
      hi John, please check and make sure you are updated to the latest version of Max 7 (7.2.3).
      there were some fixes for these text glitches in recent versions. let me know if that doesn't fix your problems.
    • Jul 06 2016 | 12:40 am
      Hi Rob. I am currently running Max (7.2.3). When I ran into difficulty I did some searching and came across a mention of the bug fix so I updated then. I still had the same problem after updating. I am going to finish the project without the use of the jit.gl. fromsymbol as Simon's solution is working well for me now.
      More than likely the problem is my limited coding/patching knowledge. Thanks again for the help both of you guys.
      John.
    • Jul 06 2016 | 3:31 pm
      thanks for checking John.
      if you are able to easily reproduce this problem in a patch without the 3rd party externals, using something like message box or text object to trigger the glitching text, I'd love to see it an try and get it fixed.
    • Jul 07 2016 | 8:56 pm
      Thanks Rob.
      If I can recreate the problem with a text box or text object. I'll update this thread.
      John.