Newish to Jitter – 2D text rendering questions – jit.gl.text2d
I’m trying to make some simple animated text in jitter that is displayed as if it is being entered by hand (eg scanning along a phrase… the rate of change would be consistent, though – I don’t need it to feel human). I have been looking at the jit.gl.text2d object, but have been finding it pretty hard going. I tried a couple of approaches – one of these is using a jit.textfile which I labouriously loaded each line with each iteration of a possible text: for example ‘H’ ‘He’ ‘Hel’ ‘Hell’ ‘Hello’. I then scrolled through this using the line object.
This is extremely… inelegant… and with this method I cannot create line-breaks. I was wondering if there was a better way to do this? I feel that there must be a very simple solution to this sort of problem. I am inexperienced with jitter beyond using it for video playback and basic video manipulation, so feel a bit out of my depth. Could anybody shed any light on this?
This turned out to be trickier than I initially thought it would. I started something here but there are still a few issues I couldn’t (or don’t have time to) resolve – mostly relatd to the limited character count that is successfully captured into the coll from textedit.
Still, I’m posting it as I went to the effort and it may be of some use to you in developing a (hopefully) better system than what you are currently using. Worse case: you can enter all the data into the coll by hand, but that could be rather tedious…
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1777.3oc0Z0siiZCF85LOEVQZU6JMK01XC3d0VU06pTe.1NZDA7jvNDHEHal zs66d8OPRlYCFGHgMYkBYsggb7we978i8WuaxzY4uvKmB9Uvm.Sl706lLQ0k riI0smLcY3KQogkpGaZT9xk7rpo2quWE+kJU++YRFGLqfG9bIHLKFTthGkDl BhVDVDFUwKDcWvy9oJPz5Bw+oJcKXg3AS4w2ClsETvmyeYUyqMU71hxWmod2 35NWEVEsHIa9iE7nJMlQADG38.e0UDS8El4.AOT+2jDqPW9rO+AOTya+o7rp rvkb0s9sBALO7NkI+q5NHn3so6Na8xjrTdkhBPMvofWJFGgUI4YGBIFRAI0U X8kc3Q7lxWW07pfxN+1c2IubukS.Y7MhQy2w+I6mSz+.UaWw0HRcucH3Xrnm BrTDU9kK1gJHyfiyhT54gEwGkPPmOBIrJOoUFIMozJJgvTyfDOk8UaTB77PI tWZJ4W.6g5oajf8zFIdc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dSKXJqGh48355aybxmOOk26MBsdMCVe9AvvlqGcv6M8Gxj8NGL8eMPyvT63k ZLrs.+ak7KkXaPginO0MMGO.lovQXvaK2tE7rXQHslYGqJGbiaEr5q.iAyxv WiNVG9tWVanniX0kpyWzyuERX2QHYlHyz4EhrKheyfpyQZSuMLndd7fwu5Gd +tEu+Lvofur+WSJk4qKhZFvMpYf83OlWVkjoNQXG7P3W8LKRhi4pa2LosLId UtPisrY+7HxBRfo6NTaMs.Obz4NaAqbaF5Drx7MOEzh7zEVxmUm2eSiABVYc W5DrzSjZQPeI9bqOrN9vcsFJ0ZCZkIoBH1iVFRAu.cvDD1tVCDrHa.q7HbcJ TqHvGp77xoKRu69VmCv51kQq2IZGnIShuNOm.5tVCDs91Psm3JrABo.aVzi6 yjMUeZMv9ncsFHVwW.rVKfRvzC.qp0.AqqMnkchS103ySWzKBZeqgpmZicva Dc6DsdtG5oRKtdN7TYGXY8Ar069JBC20ZnZ+DarZCF0E8XacGc5Kjb0adhVB P0Xn7Gzl0QnwUzzlPkX3wES1DqoLuywDS91fI5nhIlMF+X33aOgttrmdSDds L28Jbeogjq2EH.fgF.pmkzzHBIqx1vaTwDkZIMgGOHYiiE53JNQsQbhNthSL aDmj6Y+HpD3akC3wctypj6XvqOLgYiKlvVXO4OtycuIYAC09BecgIkV+HhIa V24OtdfI1jfEYjsmvWfzoGJlt.0iXnAzYElbu9vDYjiEmc8M2YUTlmpIdcYh 0mff5Cu7gMvdvCqkjG7MkWPz3a28+k5rzPA -----------end_max5_patcher-----------
Thank you very much. This is what I was looking for. Yeah… I’m not sure why it can’t handle longer texts either. However, I don’t have that much text to deal with anyway, so can put it in by hand I think. I suppose for line breaks I could render another instance of it and layer it on top. Thanks.
Cool. FWIW the jit.gl.2dtext is fed by a jit.matrix which makes that method capable of rendering multiple lines – (just try by entering multiple phrases into the text field one after the other). The thing I didn’t do is to handle the text display properly with line breaks etc.
i’m hesitant to post this, because it is absolutely uncommented, but perhaps you will be able to make use of it.
basically, it takes a text file that has paragraphs of text, separated by a blank line, and processes them to be displayed one letter at a time (as if written by someone in real time). it uses jit.gl.text3d in a poly~ object, with a poly~ instance for each line of the display.
in the main patch, you can read in a text file that’s in the searchpath, and start outputting the first paragraph by clicking the bang at the top of the patch. also, probably need to send the init bang as well. it assumes the only line-breaks are in between paragraphs in the text file
it uses the jasch externals _ (underscrore, which is prepend set) and strcat.
Hi. Thanks for your replies. I’ve been away so haven’t had time to look at much of this. I will over the next few days. Thanks again.
Forums > Jitter