Forums > Jitter

Newish to Jitter – 2D text rendering questions – jit.gl.text2d

March 8, 2011 | 2:33 pm

Hi,

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?
Jamie


March 10, 2011 | 11:09 am

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. –

March 10, 2011 | 3:58 pm

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.


March 10, 2011 | 6:03 pm

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.


March 10, 2011 | 7:40 pm

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.

Attachments:
  1. texttyper.zip

March 23, 2011 | 4:28 pm

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.


Viewing 6 posts - 1 through 6 (of 6 total)