rendering efficiency – multiple instances of subpatch

Dec 13, 2006 at 5:58pm

rendering efficiency – multiple instances of subpatch

I am relatively new to Jitter, so I’m still trying to figure out the most efficient way to use it.

The patch below is a small piece of code from a much larger project. I need to repeatedly scroll the same letter vertically across the render window. I also need to be able to make sure that multiple instances of this letter can appear and scroll simultaneously.

My current solution is to create a simple subpatch that does the scrolling, and then create multiple instances of it, using [jit.cycle] to rotate through them when a bang is received. I want to make sure that I have more than enough, otherwise the scrolling will be interupted if the subpatch is triggered too early.

The problem is, I am using this technique all over the place… and with everything else I’m doing the patch is starting to bog down. It seems inefficient to me… I know I’m constantly rendering the unused characters offscreen even though I don’t need them.

Is there a better way to do this? Any advice would be appreciated.

Thanks,
/dan

max v2;
#N vpatcher -1259 66 -72 423;
#P button 221 143 34 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 8 0 5 0;
#P connect 7 0 5 0;
#P connect 6 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 6 2;
#P connect 9 0 6 2;
#P pop;
#P newobj 1091 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 6 0 5 0;
#P connect 7 0 5 0;
#P connect 8 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 9 0 6 2;
#P connect 10 0 6 2;
#P pop;
#P newobj 1004 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 8 0 5 0;
#P connect 7 0 5 0;
#P connect 6 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 6 2;
#P connect 9 0 6 2;
#P pop;
#P newobj 917 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 6 0 5 0;
#P connect 7 0 5 0;
#P connect 8 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 9 0 6 2;
#P connect 10 0 6 2;
#P pop;
#P newobj 830 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 8 0 5 0;
#P connect 7 0 5 0;
#P connect 6 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 6 2;
#P connect 9 0 6 2;
#P pop;
#P newobj 743 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 6 0 5 0;
#P connect 7 0 5 0;
#P connect 8 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 9 0 6 2;
#P connect 10 0 6 2;
#P pop;
#P newobj 656 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 8 0 5 0;
#P connect 7 0 5 0;
#P connect 6 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 6 2;
#P connect 9 0 6 2;
#P pop;
#P newobj 569 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 6 0 5 0;
#P connect 7 0 5 0;
#P connect 8 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 9 0 6 2;
#P connect 10 0 6 2;
#P pop;
#P newobj 482 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 8 0 5 0;
#P connect 7 0 5 0;
#P connect 6 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 6 2;
#P connect 9 0 6 2;
#P pop;
#P newobj 395 266 73 196617 p LetterScroll;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 6 0 5 0;
#P connect 7 0 5 0;
#P connect 8 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 9 0 6 2;
#P connect 10 0 6 2;
#P pop;
#P newobj 308 266 73 196617 p LetterScroll;
#P newex 221 214 881 196617 jit.cycle 10;
#N vpatcher 10 59 973 621;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P message 451 124 113 196617 0.84 , -1.12 5500.;
#P newex 451 154 40 196617 line 0.;
#P newex 620 151 63 196617 loadmess 1.;
#P newex 236 314 129 196617 loadmess font courier 100;
#P newex 237 259 83 196617 loadmess text A;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 131 216 330 1441802 pak position -0.35 0.;
#P newex 131 356 112 1441802 jit.gl.text2d foo;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P comment 247 286 100 196617 Set font to courier size 100;
#P comment 612 123 100 196617 Default to vertical position of 1.;
#P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
#P window linecount 1;
#P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
#N comlet Bang to scroll;
#P inlet 451 103 15 0;
#P connect 8 0 5 0;
#P connect 7 0 5 0;
#P connect 6 0 5 0;
#P connect 0 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 6 2;
#P connect 9 0 6 2;
#P pop;
#P newobj 221 266 73 196617 p LetterScroll;
#P toggle 43 126 28 0;
#P newex 43 194 50 196617 t b erase;
#P newex 9 263 153 196617 jit.window foo 10 100 500 800;
#P newex 43 168 57 196617 qmetro 40;
#P newex 43 226 82 196617 jit.gl.render foo;
#P comment 74 133 100 196617 START RENDERING;
#P window linecount 2;
#P comment 264 151 100 196617 Bang to scroll the letter A;
#P connect 6 0 3 0;
#P connect 3 0 5 0;
#P connect 5 0 2 0;
#P connect 5 1 2 0;
#P connect 19 0 8 0;
#P connect 8 0 7 0;
#P connect 8 1 9 0;
#P connect 8 2 10 0;
#P connect 8 3 11 0;
#P connect 8 4 12 0;
#P connect 8 5 13 0;
#P connect 8 6 14 0;
#P connect 8 7 15 0;
#P connect 8 8 16 0;
#P connect 8 9 17 0;
#P connect 8 10 18 0;
#P pop;

#29213
Dec 15, 2006 at 8:02pm

::bump::

One last shot at this… anyone have any advice for me?

Thanks,
Dan

Quote: doctor op wrote on Wed, 13 December 2006 10:58
—————————————————-
> I am relatively new to Jitter, so I’m still trying to figure out the most efficient way to use it.
>
>
> The patch below is a small piece of code from a much larger project. I need to repeatedly scroll the same letter vertically across the render window. I also need to be able to make sure that multiple instances of this letter can appear and scroll simultaneously.
>
> My current solution is to create a simple subpatch that does the scrolling, and then create multiple instances of it, using [jit.cycle] to rotate through them when a bang is received. I want to make sure that I have more than enough, otherwise the scrolling will be interupted if the subpatch is triggered too early.
>
> The problem is, I am using this technique all over the place… and with everything else I’m doing the patch is starting to bog down. It seems inefficient to me… I know I’m constantly rendering the unused characters offscreen even though I don’t need them.
>
> Is there a better way to do this? Any advice would be appreciated.
>
> Thanks,
> /dan
>
> max v2;
> #N vpatcher -1259 66 -72 423;
> #P button 221 143 34 0;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 1;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 8 0 5 0;
> #P connect 7 0 5 0;
> #P connect 6 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 10 0 6 2;
> #P connect 9 0 6 2;
> #P pop;
> #P newobj 1091 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 6 0 5 0;
> #P connect 7 0 5 0;
> #P connect 8 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 9 0 6 2;
> #P connect 10 0 6 2;
> #P pop;
> #P newobj 1004 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 8 0 5 0;
> #P connect 7 0 5 0;
> #P connect 6 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 10 0 6 2;
> #P connect 9 0 6 2;
> #P pop;
> #P newobj 917 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 6 0 5 0;
> #P connect 7 0 5 0;
> #P connect 8 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 9 0 6 2;
> #P connect 10 0 6 2;
> #P pop;
> #P newobj 830 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 8 0 5 0;
> #P connect 7 0 5 0;
> #P connect 6 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 10 0 6 2;
> #P connect 9 0 6 2;
> #P pop;
> #P newobj 743 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 6 0 5 0;
> #P connect 7 0 5 0;
> #P connect 8 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 9 0 6 2;
> #P connect 10 0 6 2;
> #P pop;
> #P newobj 656 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 8 0 5 0;
> #P connect 7 0 5 0;
> #P connect 6 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 10 0 6 2;
> #P connect 9 0 6 2;
> #P pop;
> #P newobj 569 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 6 0 5 0;
> #P connect 7 0 5 0;
> #P connect 8 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 9 0 6 2;
> #P connect 10 0 6 2;
> #P pop;
> #P newobj 482 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 8 0 5 0;
> #P connect 7 0 5 0;
> #P connect 6 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 10 0 6 2;
> #P connect 9 0 6 2;
> #P pop;
> #P newobj 395 266 73 196617 p LetterScroll;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 6 0 5 0;
> #P connect 7 0 5 0;
> #P connect 8 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 9 0 6 2;
> #P connect 10 0 6 2;
> #P pop;
> #P newobj 308 266 73 196617 p LetterScroll;
> #P newex 221 214 881 196617 jit.cycle 10;
> #N vpatcher 10 59 973 621;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 0;
> #P message 451 124 113 196617 0.84 , -1.12 5500.;
> #P newex 451 154 40 196617 line 0.;
> #P newex 620 151 63 196617 loadmess 1.;
> #P newex 236 314 129 196617 loadmess font courier 100;
> #P newex 237 259 83 196617 loadmess text A;
> #P window setfont “Fixedwidth Serif” 10.;
> #P newex 131 216 330 1441802 pak position -0.35 0.;
> #P newex 131 356 112 1441802 jit.gl.text2d foo;
> #B color 5;
> #P window setfont “Sans Serif” 9.;
> #P window linecount 2;
> #P comment 247 286 100 196617 Set font to courier size 100;
> #P comment 612 123 100 196617 Default to vertical position of 1.;
> #P comment 380 75 118 196617 Bang in to start vertical scroll of letter;
> #P window linecount 1;
> #P comment 50 50 612 196617 This subpatch is used to display a single letter in the rendering window , and move it from top to bottom of the screen when triggered.;
> #N comlet Bang to scroll;
> #P inlet 451 103 15 0;
> #P connect 8 0 5 0;
> #P connect 7 0 5 0;
> #P connect 6 0 5 0;
> #P connect 0 0 11 0;
> #P connect 11 0 10 0;
> #P connect 10 0 6 2;
> #P connect 9 0 6 2;
> #P pop;
> #P newobj 221 266 73 196617 p LetterScroll;
> #P toggle 43 126 28 0;
> #P newex 43 194 50 196617 t b erase;
> #P newex 9 263 153 196617 jit.window foo 10 100 500 800;
> #P newex 43 168 57 196617 qmetro 40;
> #P newex 43 226 82 196617 jit.gl.render foo;
> #P comment 74 133 100 196617 START RENDERING;
> #P window linecount 2;
> #P comment 264 151 100 196617 Bang to scroll the letter A;
> #P connect 6 0 3 0;
> #P connect 3 0 5 0;
> #P connect 5 0 2 0;
> #P connect 5 1 2 0;
> #P connect 19 0 8 0;
> #P connect 8 0 7 0;
> #P connect 8 1 9 0;
> #P connect 8 2 10 0;
> #P connect 8 3 11 0;
> #P connect 8 4 12 0;
> #P connect 8 5 13 0;
> #P connect 8 6 14 0;
> #P connect 8 7 15 0;
> #P connect 8 8 16 0;
> #P connect 8 9 17 0;
> #P connect 8 10 18 0;
> #P pop;
>
—————————————————-

#90711
Dec 17, 2006 at 4:18pm

> Quote: doctor op wrote on Wed, 13 December 2006 10:58
> —————————————————-
> >
> > The problem is, I am using this technique all over the place… and with
> everything else I’m doing the patch is starting to bog down. It seems
> inefficient to me… I know I’m constantly rendering the unused characters
> offscreen even though I don’t need them.
> >
> > Is there a better way to do this? Any advice would be appreciated.
> >
> > Thanks,
> > /dan
> >

Hi Dan,

There are a few things you can do to make the number of letters dynamically
available without charging your computer for things you don’t use.

The most efficient method I think will be to render your text to a texture
(with alpha channel) and use the texture to on multiple jit.gl.gridshapes.
Using @automatic 0 for every shape lets you change the position of the
object and render multiple instances for each frame. You can also check out
jit.gl.multiple which is designed to make this kind of thing.

other options would be:

- @automatic 0, for each text object, will let render only the ones you use
by sending the bang manually. You control the rendering sequence rather than
letting jit.gl.render draw every gl object sitting somewhere in the patch
doing nothing.

- use [poly~] to dynamically instantiate copies of your patchers. This was
designed for polyphonic audio patches, but works with jitter as well. Randy
Jones has an example on his site at http://www.2uptech.com

- use javascript to dynamically allocate the number of objects you need

cheers, -thijs

#90712
Dec 17, 2006 at 8:08pm

I had to make a scroll bar one time and I found JAVA to be the best
solution. I made an mxj that would read a textfile and use
jit.gl.text2d to scroll the letters across the bottom of the screen.
Using multithreading, I found the timing to be much more reliable,
making the scrolling very smooth.

wes

#90713
Dec 17, 2006 at 9:23pm

How do you ensure multi_threading? Does it work with JS patches as well?

Thanks, Greg
On Dec 17, 2006, at 12:08 PM, Wesley Smith wrote:

> I had to make a scroll bar one time and I found JAVA to be the best
> solution. I made an mxj that would read a textfile and use
> jit.gl.text2d to scroll the letters across the bottom of the screen.
> Using multithreading, I found the timing to be much more reliable,
> making the scrolling very smooth.
>
> wes

#90714
Dec 17, 2006 at 9:31pm

Check out the java forum and search for threading there. There are
some good code examples of multithreading in JAVA. For example:

http://www.cycling74.com/forums/index.php?t=msg&goto=52550&rid=0&srch=multithreading+mxj#msg_52550

wes

#90715

You must be logged in to reply to this topic.