Downsample GL jit.window source to Jit.matrix?

May 16, 2008 at 5:58pm

Downsample GL jit.window source to Jit.matrix?

Hi Folks!

I have created a multiscreen openGL patch with a character following the trajectory co-ordinates of a sound being encoded and dispersed by the ICST ambisonics externals.

I now need to take the information from one of the GL renderers to creat a low res matrix to generate a list of values to be sent to an arduino to control an LED matrix.

Has anybody any idea how I can reprocess an a jit.window as a jit.matrix?

Also if anybody could help me with converting the values of a matrix into a list for distribution to the arduino that would be great!

Thanks,

Conor

#37836
May 16, 2008 at 6:51pm

there are are many ways to readback from gpu to jit.matrix.
see for one the readback patch in the example folder (search for readback,
dono exact name). if your going more cutting edge try 40 recpies in andrew’s
third cookbook.
you should defently dimscale your slab before sending it back, you dont need
everything as i imagine.

to read values from matrix you use jit.spill or jit.iter

On Fri, May 16, 2008 at 8:58 PM, Conor wrote:

>
> Hi Folks!
>
> I have created a multiscreen openGL patch with a character following the
> trajectory co-ordinates of a sound being encoded and dispersed by the ICST
> ambisonics externals.
>
> I now need to take the information from one of the GL renderers to creat a
> low res matrix to generate a list of values to be sent to an arduino to
> control an LED matrix.
>
> Has anybody any idea how I can reprocess an a jit.window as a jit.matrix?
>
> Also if anybody could help me with converting the values of a matrix into a
> list for distribution to the arduino that would be great!
>
> Thanks,
>
> Conor
>

#130950
May 17, 2008 at 2:09am

create a small and simple patch demonstrating the problem and your likely to get more help.

#130951
May 17, 2008 at 2:28am

Cheers robtherich
Here is a simplified version of the patch

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 614 719 209 9109513 jit.window Center 40 40 320 240 @depthbuffer 1;
#B color 5;
#P toggle 67 617 15 0;
#P message 67 635 88 9109513 poly_mode $1 $1;
#P newex 157 663 61 9109513 s gridshape;
#P toggle 179 617 15 0;
#P message 179 635 66 9109513 enable $1;
#N vpatcher 627 319 1290 784;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 429 56 87 9109513 onepole~ 500. Hz;
#P flonum 381 256 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 285 255 92 9109513 scale -60. 0. 0. 2.;
#P comment 220 338 80 9109513 z;
#P flonum 202 317 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P hidden newex 503 492 106 9109513 bgcolor 100 100 100;
#P window linecount 3;
#P comment 244 33 156 9109513 generate some 3d cartesian coords for positioning the gridshape object…;
#P window linecount 1;
#P comment 3 62 34 9109513 reset;
#P toggle 264 83 15 0;
#P flonum 375 134 35 9 -1. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 161 216 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 160 196 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 126 238 27 9109513 + 0.;
#P newex 126 217 29 9109513 * 1.;
#P newex 126 273 59 9109513 * 6.28318;
#P newex 50 273 59 9109513 * 6.28318;
#P flonum 85 217 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 84 197 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 50 239 27 9109513 + 0.;
#P newex 50 218 29 9109513 * 1.;
#P comment 167 49 44 9109513 speed…;
#P flonum 470 190 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 470 170 98 9109513 scale -40. 0. 99. 0.;
#P flonum 457 150 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P user levelmeter~ 457 82 128 64 40 20 300 0 -40 0 0 0 0 0 0;
#X brgb 240 240 240;
#X frgb 200 200 200;
#X rgb2 0 0 0;
#X rgb3 0 0 0;
#X rgb4 0 0 0;
#X rgb5 255 0 0;
#X rgb6 220 100 100;
#X rgb7 220 150 80;
#X rgb8 220 200 100;
#X rgb9 180 210 100;
#X markers 12 6 0 -6 -12 -24 -36 -48 42983600;
#X markersused 8;
#X done;
#P message 470 209 80 9109513 hsl $1 255 128;
#P user swatch 470 228 166 78;
#P message 470 341 90 9109513 color $1 $2 $3 1.;
#P newex 470 317 82 9109513 vexpr $i1/255.;
#P flonum 338 134 35 9 -1. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 301 134 35 9 -1. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 264 134 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 241 161 104 9109513 pak rotate 0. 0. 0. 0.;
#P message 340 350 78 9109513 scale $1 $1 $1;
#P newex 50 364 83 9109513 prepend position;
#P toggle 410 33 15 0;
#P newex 429 33 31 9109513 adc~;
#P flonum 340 328 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 126 317 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 126 296 23 9109513 cos;
#P newex 50 399 61 9109513 s gridshape;
#P newex 50 338 162 9109513 0. 0. 0.;
#P flonum 50 317 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 50 296 21 9109513 sin;
#P message 9 76 17 9109513 0.;
#P flonum 93 162 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 128 48 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 128 67 29 9109513 * 1.;
#P newex 50 162 40 9109513 t f f f;
#P newex 70 117 29 9109513 * 1.;
#P newex 50 139 50 9109513 accum 0.;
#P newex 70 96 37 9109513 0.025;
#P newex 50 74 40 9109513 t b b b;
#P toggle 50 31 15 0;
#P newex 50 52 57 9109513 qmetro 40;
#P comment 168 291 80 9109513 convert to rads;
#N vpatcher 408 58 881 302;
#P window setfont “Sans Serif” 9.;
#P number 65 101 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 79 50 64 9109513 metro 2000;
#P newex 263 111 41 9109513 * 0.01;
#P newex 263 92 64 9109513 random 100;
#P newex 196 111 41 9109513 * 0.01;
#P newex 196 92 64 9109513 random 100;
#P newex 129 111 41 9109513 * 0.01;
#P newex 129 92 64 9109513 random 100;
#P newex 50 123 46 9109513 0. 2000;
#P newex 50 79 70 9109513 random 3000;
#P newex 50 148 53 9109513 line 1. 40;
#P inlet 79 30 15 0;
#P outlet 263 133 15 0;
#P outlet 196 133 15 0;
#P outlet 129 133 15 0;
#P outlet 50 170 15 0;
#P connect 14 0 6 0;
#P connect 6 0 7 0;
#P connect 7 0 5 0;
#P connect 5 0 0 0;
#P connect 6 0 15 0;
#P connect 4 0 14 0;
#P connect 14 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 1 0;
#P connect 14 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 2 0;
#P connect 14 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 3 0;
#P pop;
#P newobj 264 110 72 9109513 p rand_rotate;
#P connect 3 0 2 0;
#P connect 2 0 4 0;
#P connect 12 0 6 0;
#P connect 4 0 6 0;
#P connect 6 0 8 0;
#P connect 8 0 37 0;
#P connect 37 0 38 0;
#P connect 38 0 41 0;
#P connect 41 0 13 0;
#P connect 13 0 14 0;
#P connect 14 0 15 0;
#P connect 15 0 22 0;
#P fasten 24 0 16 0 246 387 55 387;
#P fasten 29 0 16 0 475 391 55 391;
#P connect 22 0 16 0;
#P fasten 23 0 16 0 345 389 55 389;
#P connect 40 0 38 1;
#P connect 39 0 37 1;
#P connect 4 1 5 0;
#P connect 5 0 7 0;
#P connect 7 0 6 1;
#P fasten 9 0 7 1 133 116 94 116;
#P connect 8 2 11 0;
#P fasten 8 1 43 0 70 188 131 188;
#P connect 43 0 44 0;
#P connect 44 0 42 0;
#P connect 42 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 15 1;
#P connect 10 0 9 0;
#P connect 46 0 44 1;
#P connect 45 0 43 1;
#P fasten 54 0 52 0 290 312 207 312;
#P connect 52 0 15 2;
#P fasten 4 2 24 0 85 93 246 93;
#P connect 48 0 0 0;
#P connect 0 0 25 0;
#P connect 25 0 24 1;
#P fasten 33 0 54 0 462 248 290 248;
#P connect 26 0 24 2;
#P connect 0 1 26 0;
#P connect 27 0 24 3;
#P connect 47 0 24 4;
#P connect 0 2 27 0;
#P connect 19 0 23 0;
#P connect 55 0 54 5;
#P connect 0 3 47 0;
#P connect 21 0 20 0;
#P connect 20 0 56 0;
#P connect 56 0 32 0;
#P connect 32 0 33 0;
#P connect 33 0 34 0;
#P connect 34 0 35 0;
#P connect 35 0 31 0;
#P connect 31 0 30 0;
#P connect 30 0 28 0;
#P connect 28 0 29 0;
#P pop;
#P newobj 156 684 77 9109513 p some_coords;
#P newex 388 730 72 9109513 s gridshape;
#P toggle 366 706 15 0;
#P message 388 706 114 9109513 smooth_shading $1;
#P comment 350 657 145 9109513 Object Lighting Attributes;
#B color 5;
#P toggle 366 679 15 0;
#P message 388 679 114 9109513 lighting_enable $1;
#P user panel 350 670 200 92;
#X brgb 141 223 255;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window linecount 3;
#P newex 823 351 163 9109513 jit.gl.gridshape Right @poly_mode 1 1 @shape plane @scale 4. 4. 4. @color 1. 1. 0.;
#B color 5;
#P window linecount 1;
#P comment 810 269 116 9109513 Yellow Plane;
#B color 5;
#P toggle 823 295 15 0;
#P message 823 316 104 9109513 poly_mode $1 $1;
#P toggle 932 295 15 0;
#P message 932 316 66 9109513 enable $1;
#P user panel 810 284 195 129;
#X brgb 246 251 112;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P comment 828 107 81 9109513 Start Rendering;
#P newex 813 131 62 9109513 qmetro 40;
#P toggle 813 104 15 0;
#P newex 879 166 47 9109513 r renderC;
#P newex 813 166 62 9109513 t b erase;
#P newex 813 206 85 9109513 jit.gl.render Center;
#B color 5;
#P window setfont “Sans Serif” 12.;
#P flonum 672 290 35 12 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 2;
#P newex 648 243 52 9109513 scale 0 127 30. -30.;
#P window setfont “Sans Serif” 12.;
#P flonum 589 291 35 12 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P newex 558 245 54 9109513 scale 0 127 -30. 30.;
#P user pictslider 564 132 100 100 4 4 4 4 SliderDefaultKnob.pct 1 SliderDefaultBkgnd.pct 1 2163 0 8323072 127 1. 1.;
#P window setfont “Sans Serif” 12.;
#P window linecount 1;
#P newex 554 371 52 9109516 pack f f f;
#P button 554 310 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 554 403 20 9109513 t b;
#P message 577 403 90 9109513 position $1 $2 $3;
#P flonum 661 343 50 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 607 343 50 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 554 343 50 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 614 101 69 9109513 complexity…;
#P number 577 99 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 521 99 54 9109513 dim $1 $1;
#P newex 510 77 71 9109513 prepend shape;
#P user ubumenu 584 77 72 9109513 0 1 1 0;
#X add sphere;
#X add torus;
#X add cylinder;
#X add opencylinder;
#X add cube;
#X add opencube;
#X add plane;
#X add circle;
#X prefix_set 0 0 0;
#X pattrmode 1;
#P message 500 58 111 9109513 scale 0.3 0.3 0.3;
#P newex 622 484 72 9109513 r gridshape;
#P comment 495 39 142 9109513 Shape;
#B color 5;
#P newex 500 506 99 9109513 jit.gl.gridshape Center;
#B color 5;
#P user panel 495 55 200 75;
#X brgb 76 158 255;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P hidden message 290 55 24 9109513 100;
#P hidden message 271 55 20 9109513 0.1;
#P hidden message 250 55 20 9109513 45.;
#P message 102 324 94 9109513 lens_angle $1;
#P flonum 102 304 39 9 0.1 0 1 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 102 268 15 0;
#P message 124 268 60 9109513 ortho $1;
#P comment 105 247 113 9109513 orthographic projection;
#P comment 121 349 73 9109513 clipping planes;
#P hidden message 232 55 17 9109513 2;
#P hidden message 209 55 17 9109513 1;
#P hidden newex 209 21 50 9109513 loadbang;
#P comment 92 55 89 9109513 jit.gl.render axes;
#P toggle 93 71 15 0;
#P message 115 71 52 9109513 axes $1;
#P comment 161 165 48 9109513 up vector;
#P comment 149 95 81 9109513 camera position;
#P message 178 386 79 9109513 far_clip $1;
#P flonum 178 366 39 9 0.1 100. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 91 386 79 9109513 near_clip $1;
#P flonum 91 366 39 9 0.1 100. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 217 178 39 9109513 z;
#P comment 175 178 39 9109513 y;
#P comment 132 178 39 9109513 x;
#P flonum 214 194 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 173 194 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 132 194 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 91 216 133 9109513 pak up 0. 1. 0.;
#P comment 216 108 39 9109513 z;
#P comment 174 108 39 9109513 y;
#P comment 131 108 39 9109513 x;
#P flonum 220 125 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 172 124 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 131 124 39 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 90 146 133 9109513 pak camera 0. 0. 2.;
#P newex 76 531 49 9109513 s renderC;
#P comment 60 26 145 9109513 Camera View Attributes;
#B color 5;
#P user panel 61 41 210 536;
#X brgb 255 176 76;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P number 162 478 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P hidden newex 115 458 106 9109513 bgcolor 100 100 100;
#P window setfont “Sans Serif” 14.;
#P window linecount 3;
#P comment 809 485 260 9109518 How do I output the live gl rendering to a jit.matrix to in turn create a list using jit.iter?;
#P window setfont “Sans Serif” 12.;
#P window linecount 1;
#P comment 673 151 100 9109516 position control;
#P connect 89 0 88 0;
#P fasten 38 0 6 0 107 348 81 348;
#P fasten 35 0 6 0 129 292 81 292;
#P fasten 7 0 6 0 95 169 81 169;
#P fasten 14 0 6 0 96 250 81 250;
#P fasten 27 0 6 0 120 97 81 97;
#P fasten 24 0 6 0 183 427 81 427;
#P fasten 22 0 6 0 96 427 81 427;
#P hidden fasten 40 0 21 0 276 351 96 351;
#P connect 21 0 22 0;
#P hidden connect 39 0 37 0;
#P connect 37 0 38 0;
#P fasten 28 0 27 0 98 88 112 88 112 69 120 69;
#P fasten 36 0 35 0 107 285 121 285 121 266 129 266;
#P connect 8 0 7 1;
#P connect 15 0 14 1;
#P fasten 85 0 87 0 184 655 162 655;
#P fasten 88 0 87 0 72 655 162 655;
#P connect 9 0 7 2;
#P hidden connect 31 0 16 0;
#P connect 16 0 14 2;
#P hidden fasten 41 0 23 0 295 361 183 361;
#P connect 23 0 24 0;
#P connect 86 0 85 0;
#P hidden connect 30 0 31 0;
#P connect 10 0 7 3;
#P connect 17 0 14 3;
#P hidden connect 30 0 32 0;
#P hidden fasten 30 0 39 0 214 40 255 40;
#P hidden fasten 30 0 40 0 214 40 276 40;
#P hidden fasten 30 0 41 0 214 40 295 40;
#P fasten 79 0 78 0 371 697 385 697 385 674 393 674;
#P fasten 82 0 81 0 371 723 384 723 384 704 393 704;
#P fasten 78 0 83 0 393 700 507 700 507 725 393 725;
#P connect 81 0 83 0;
#P connect 56 0 43 0;
#P connect 55 0 43 0;
#P fasten 45 0 43 0 627 502 505 502;
#P fasten 49 0 43 0 526 461 505 461;
#P fasten 48 0 43 0 515 460 505 460;
#P connect 46 0 43 0;
#P connect 47 1 48 0;
#P connect 50 0 49 0;
#P connect 68 0 57 0;
#P connect 57 0 52 0;
#P connect 61 0 52 0;
#P connect 52 0 58 0;
#P connect 58 0 56 0;
#P connect 59 0 60 0;
#P connect 53 0 58 1;
#P connect 58 0 55 0;
#P connect 60 0 61 0;
#P connect 54 0 58 2;
#P connect 57 0 53 0;
#P connect 59 1 62 0;
#P connect 57 0 54 0;
#P connect 63 0 54 0;
#P connect 62 0 63 0;
#P connect 67 0 68 0;
#P connect 68 0 65 0;
#P fasten 65 1 64 0 870 193 818 193;
#P connect 65 0 64 0;
#P fasten 66 0 64 0 884 198 818 198;
#P connect 74 0 73 0;
#P connect 73 0 76 0;
#P fasten 71 0 76 0 937 333 828 333;
#P connect 72 0 71 0;
#P window clipboard copycount 91;

#130952
May 17, 2008 at 3:41am

jit.gl.gridshape @matrixoutput 1 ?

this is covered pretty well in the tutorials and the example patches.

matrixoutput sends the list of vertices that make up the geometric shape out the left outlet in matrix form. therefore if you connect this output to jit.window, you will see the colors you mentioned earlier. this is expected behavior.

what are you trying to accomplish with this list?

#130953

You must be logged in to reply to this topic.