(no subject)


    Aug 06 2006 | 11:01 am

    • Aug 06 2006 | 11:23 am
      Rather than banging your head against jit.gl.text2d, you may want to make a JS that does the newline thing on its own and uses jit.gl.text2d to draw the text appropriately.
      wes
      On 8/6/06, David Plans Casal wrote: > Hello all, > > I've posted this question on the jitter list (and now also max/msp > list) but despite some help there I still can't figure this out. > > I've just been given a project where I have to display iterative > zeros (and after the other, every second) on a screen unless > something happens, in which case I need to display a 1 and stop. My > problem right now is that while I can [metro 1000]-->"append $1" to > jit.gl.text2d, I cannot get newline to work. I'm thinking about doing > it with Javascript... > > I've been searching the archives and I can only find a post in 2003 > here: > > http://www.synthesisters.com/hypermail/max-msp/Nov03/8085.html > > This solution implements 'newline' by truncating through a jit.concat > object, but I can only get 2 lines, and of course "append $1" doesn't > work because of the symbol conversion. > > I see also from the archives that someone asked about doing newline > in gl text with javascript and jit.gl.text3d, but couldn't find any > actual details. > > Has anyone done this? Perhaps there is a simpler way to do it, > without using Jitter? > > Maybe I could do it with Javascript? > > I would really appreciate any comments at all, I can't seem to crack > this. Below I attach my draft patch, which uses the 2003 solution but > just doesn't go any further. > > Yelp! > > David > > max v2; > #N vpatcher 208 44 1023 716; > #P origin 4 39; > #P window setfont "Sans Serif" 9.; > #P window linecount 1; > #P newex 631 273 61 196617 sprintf %ld; > #P newex 631 295 93 196617 jit.str.fromsymbol; > #P button 599 235 15 0; > #P number 633 231 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 532 271 58 196617 sprintf %d; > #P newex 529 403 93 196617 jit.gl.text2d zeros; > #P newex 532 344 176 196617 jit.concat @concatdim 1 @truncate 1; > #P newex 532 293 95 196617 jit.str.fromsymbol; > #P message 158 113 68 196617 fullscreen $1; > #P toggle 158 90 15 0; > #P newex 158 143 86 196617 jit.window zeros; > #P message 464 283 55 196617 append $1; > #P toggle 453 491 15 0; > #P message 453 511 55 196617 classic $1; > #P newex 107 192 65 196617 pak rotate 0.; > #P flonum 107 172 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P flonum 222 172 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 183 192 74 196617 pak scale 1. 1.; > #P flonum 183 172 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 103 545 60 196617 pak size 12; > #P user jit.fpsgui 14 135 60 196617 0; > #P button 16 438 15 0; > #P newex 16 459 42 196617 fontlist; > #P message 190 546 64 196617 tracking $1; > #P flonum 190 527 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P user ubumenu 283 524 60 196617 0 1 1 0; > #X add left; > #X add center; > #X add right; > #X prefix_set 0 0 0; > #P message 283 545 50 196617 align $1; > #P newex 14 70 43 196617 jit.qball; > #P flonum 392 171 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P number 139 308 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P window linecount 3; > #P comment 151 350 133 196617 the plane offset sets which plane of a > multi-plane char matrix to display.; > #P window linecount 1; > #P message 139 327 64 196617 plane $1; > #P window linecount 0; > #P comment 283 470 158 196617; > #P window linecount 1; > #P message 174 281 95 196617 append and cult jam; > #P comment 299 212 65 196617 color (RGBA); > #P comment 27 212 71 196617 position (xy); > #P flonum 355 171 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P flonum 319 171 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 283 190 144 196617 pak color 0. 0. 0. 1.; > #P flonum 281 170 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P flonum 59 172 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 13 192 85 196617 pak position 0. 0.; > #P message 285 446 64 196617 leadscale $1; > #P flonum 285 427 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P message 15 281 98 196617 text Hamburgefonts; > #P toggle 15 311 15 0; > #P newex 15 330 51 196617 metro 10; > #P message 119 281 49 196617 text 310; > #P hidden newex 132 56 50 196617 loadbang; > #P comment 31 312 100 196617 char matrix as text.; > #P flonum 13 172 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 168 460 89 196617 prepend face; > #P user ubumenu 168 436 95 196617 0 1 1 0; > #X add normal; > #X add bold; > #X add italic; > #X prefix_set 0 0 0; > #P number 103 502 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; > #P newex 16 502 66 196617 tosymbol; > #P newex 16 545 75 196617 pak font Times; > #P user ubumenu 16 481 147 196617 0 1 1 0; > #X add Geneva; > #X add Monaco; > #X add Times; > #X add Helvetica; > #X add Courier; > #X add Symbol; > #X add "Lucida Grande"; > #X add "Zapf Dingbats"; > #X add .TimesLTMM_1_Wt_1_Wd; > #X add .HelveLTMM_170_Wt_1200_Wd; > #X add Osaka; > #X add OsakaÅ|ìôïù; > #X add "Apple LiGothic Medium"; > #X add AppleGothic; > #X add "Monaco CY"; > #X add "Lucida Grande CY"; > #X add "Times CY"; > #X add Hei; > #X add "Geneva CE"; > #X add "Monaco CE"; > #X add "Times CE"; > #X add "Helvetica CE"; > #X add "Lucida Grande CE"; > #X add "Courier CE"; > #X add ª™Œƒœ∏∫⁄; > #X add "Geeza Pro Bold"; > #X add "ƒ◊∂¬ Pro"; > #X add "Geeza Pro"; > #X add ª™Œƒ∫⁄ÃÂ; > #X add Palatino; > #X add Seville; > #X add Zapfino; > #X add Cracked; > #X add "Trebuchet MS"; > #X add "Mona Lisa Solid ITC TT"; > #X add "Princetown LET"; > #X add ProFont; > #X add "Edwardian Script ITC"; > #X add "Bodoni SvtyTwo OS ITC TT-Book"; > #X add "Bodoni SvtyTwo OS ITC TT-Bold"; > #X add "Bodoni SvtyTwo ITC TT-BookIta"; > #X add "PortagoITC TT"; > #X add "BlairMdITC TT-Medium"; > #X add "Stone Sans ITC TT-Bold"; > #X add "Stone Sans ITC TT-SemiIta"; > #X add "Arial Narrow"; > #X add Arial; > #X add "Century Gothic"; > #X add "Courier New"; > #X add "Monotype Sorts"; > #X add "Times New Roman"; > #X add Wingdings; > #X add "Hoefler Text"; > #X add "Hoefler Text Ornaments"; > #X add "Marker Felt"; > #X add Impact; > #X add Skia; > #X add "Stone Sans ITC TT-Semi"; > #X add Copperplate; > #X add "Synchro LET"; > #X add "SchoolHouse Printed A"; > #X add "Apple Chancery"; > #X add "Bodoni Ornaments ITC TT"; > #X add "Copperplate Light"; > #X add Baskerville; > #X add "Baskerville Semibold"; > #X add "Big Caslon"; > #X add "Bodoni SvtyTwo OS ITC TT-BookIt"; > #X add "Bodoni SvtyTwo ITC TT-Book"; > #X add "Bradley Hand ITC TT-Bold"; > #X add "Arial Rounded MT Bold"; > #X add "Brush Script MT"; > #X add "Copperplate Gothic Light"; > #X add JazzPerc; > #X add "American Typewriter"; > #X add "American Typewriter Condensed"; > #X add "American Typewriter Light"; > #X add "American Typewriter Condensed Light"; > #X add Maestro; > #X add "Maestro Wide"; > #X add Petrucci; > #X add Tamburo; > #X add JazzCord; > #X add Futura; > #X add "Futura Condensed"; > #X add "Optima ExtraBlack"; > #X add Herculanum; > #X add "Gill Sans"; > #X add "Gill Sans Light"; > #X add "Comic Sans MS"; > #X add "Copperplate Gothic Bold"; > #X add "Helvetica Neue"; > #X add "Helvetica Neue Bold Condensed"; > #X add "Helvetica Neue UltraLight"; > #X add "Helvetica Neue Light"; > #X add "Helvetica Neue Black Condensed"; > #X add Papyrus; > #X add "Lucida Handwriting"; > #X add Optima; > #X add Tahoma; > #X add "Andale Mono"; > #X add Verdana; > #X add "JazzText Extended"; > #X add JazzText; > #X add "Snell Roundhand"; > #X add "Snell Roundhand Bold"; > #X add "Snell Roundhand Black"; > #X add Didot; > #X add EngraverTime; > #X add "Arial Black"; > #X add Georgia; > #X add EngraverTextNCS; > #X add EngraverTextT; > #X add EngraverTextH; > #X add EngraverFontExtras; > #X add EngraverFontSet; > #X add "Bodoni SvtyTwo ITC TT-Bold"; > #X add "Bank Gothic"; > #X add Opus; > #X add "Opus Metronome"; > #X add "Opus Roman Chords"; > #X add "Opus Japanese Chords"; > #X add "Opus Figured Bass Extras"; > #X add "Opus Figured Bass"; > #X add "Opus Text"; > #X add "Opus Special"; > #X add "Opus PlainChords"; > #X add "Opus Percussion"; > #X add "Opus Chords"; > #X add "Inkpen2 Chords"; > #X add "Inkpen2 Text"; > #X add "Inkpen2 Script"; > #X add "Inkpen2 Special"; > #X add Inkpen2; > #X add "Inkpen2 Metronome"; > #X add Helsinki; > #X add "Helsinki Special"; > #X add "Helsinki Metronome"; > #X add "Helsinki Text"; > #X add Webdings; > #X add ProFontIsoLatin1; > #X add Cochin; > #X add "Maestro Percussion"; > #X add "Jazz LET"; > #X add "Savoye LET"; > #X add Jazz; > #X add "Santa Fe LET"; > #X add "Blackmoor LET"; > #X add "Party LET"; > #X add "Handwriting - Dakota"; > #X add BiauKai; > #X add "Apple LiSung Light"; > #X add AppleMyungjo; > #X add #±√º≠√º; > #X add #«ÏµÂ∂Û¿ŒA; > #X add #« ±‚√º; > #X add #PC∏Ì¡∂; > #X add "Geneva CY"; > #X add "Charcoal CY"; > #X add "Helvetica CY"; > #X add Song; > #X add Kai; > #X add "Fang Song"; > #X add "Bitstream Vera Sans Oblique"; > #X add "Bitstream Vera Serif"; > #X add ª™ŒƒÀŒÃÂ; > #X add Chalkboard; > #X add "Bell Gothic Bold BT"; > #X add "Bitstream Vera Serif Bold"; > #X add OpenSymbol; > #X add "Euphemia UCAS Italic"; > #X add "Bitstream Vera Sans Mono Bold Oblique"; > #X add "ƒ◊ß∫ Pro"; > #X add "Bell Gothic Black BT"; > #X add Ayuthaya; > #X add ProggyTinyTT; > #X add Thonburi; > #X add "Bitstream Vera Sans Mono Oblique"; > #X add ª™Œƒø¨ÃÂ; > #X add "Bitstream Vera Sans Bold"; > #X add "Bitstream Vera Sans Bold Oblique"; > #X add "Bitstream Vera Sans Mono"; > #X add "Euphemia UCAS Bold"; > #X add InaiMathi; > #X add "Euphemia UCAS"; > #X add "Bitstream Vera Sans Mono Bold"; > #X add "Chalkboard Bold"; > #X add "Bitstream Vera Sans"; > #X add Silom; > #X add "Bell Gothic BT"; > #X add ª™Œƒ∑¬ÀŒ; > #X add "GB18030 Bitmap"; > #X add "Curlz MT"; > #X add Krungthep; > #X add Sathu; > #X add "Plantagenet Cherokee"; > #X prefix_set 0 0 0; > #P newex 14 90 50 196617 t b erase; > #P toggle 14 27 15 0; > #P newex 14 49 58 196617 metro 100; > #P newex 14 113 93 196617 jit.gl.render zeros; > #P newex 429 598 63 196617 print text2d; > #P newex 15 352 109 196617 jit.noise 4 char 10 10; > #P message 523 243 14 196617 0; > #P connect 5 0 4 0; > #P connect 4 0 36 0; > #P connect 36 0 6 0; > #P connect 6 0 3 0; > #P fasten 6 1 3 0 59 110 19 110; > #P connect 3 0 43 0; > #P hidden connect 15 0 19 0; > #P connect 18 0 17 0; > #P connect 17 0 1 0; > #P hidden connect 15 0 41 0; > #P connect 42 0 41 0; > #P connect 41 0 7 0; > #P fasten 7 1 9 0 89 499 21 499; > #P fasten 13 0 22 1 18 189 55 189; > #P fasten 9 0 8 1 21 541 86 541; > #P fasten 23 0 22 2 64 189 92 189; > #P connect 34 0 32 0; > #P fasten 10 0 44 1 108 531 158 531; > #P connect 54 0 55 0; > #P connect 55 0 53 0; > #P fasten 48 0 49 1 112 189 167 189; > #P fasten 11 1 12 0 215 455 173 455; > #P connect 39 0 40 0; > #P fasten 45 0 46 1 188 189 220 189; > #P fasten 47 0 46 2 227 189 252 189; > #P connect 38 0 37 0; > #P connect 20 0 21 0; > #P fasten 24 0 25 1 286 188 321 188; > #P fasten 26 0 25 2 324 188 354 188; > #P fasten 27 0 25 3 360 188 387 188; > #P fasten 35 0 25 4 397 188 420 188; > #P connect 51 0 50 0; > #P connect 57 0 58 0; > #P connect 44 0 58 0; > #P connect 22 0 58 0; > #P connect 49 0 58 0; > #P connect 25 0 58 0; > #P connect 46 0 58 0; > #P connect 61 0 59 0; > #P connect 0 0 59 0; > #P connect 59 0 56 0; > #P connect 56 0 57 0; > #P connect 60 0 61 0; > #P connect 61 0 63 0; > #P connect 60 0 63 0; > #P connect 63 0 62 0; > #P connect 62 0 57 1; > #P pop; > > > > >
    • Aug 06 2006 | 3:02 pm
    • Aug 07 2006 | 4:49 pm
      I must admit I'm a bit confused by exactly you want to do, but here's a patch that should help you. It shows how to do the 000001 thing as well as how to make jit.gl.text2d do multiline text display.
      best, wes
      ------------------text2d-newline.js-------------------------------------- autowatch = 1;
      var renderContext = "text";
      var text2d = new JitterObject("jit.gl.text2d", renderContext); text2d.automatic = 0; var vOrigin = [0., 0., 0.]; var vLineHeight = 0.1;
      var text = ""; var vProblem = 0;
      function draw() { text2d.position = vOrigin; text2d.text(text); text2d.draw();
      //negative because of flipped OpenGL y-axis text2d.position = [vOrigin[0], vOrigin[1]-vLineHeight, vOrigin[2]]; text2d.text("new line"); text2d.draw(); }
      function addZero() { if(!vProblem) text += "0"; }
      function clear() { text = ""; vProblem = 0; }
      function problem() { text += "1"; draw(); vProblem = 1; }
      function origin(vals) { vOrigin = arrayfromargs(arguments); }
      function lineHeight(val) { vLineHeight = val; }