Gl position of argb edges…

Jul 3, 2010 at 5:56pm

Gl position of argb edges…

Sorry if it has already discussed, but couldn’t find anything about that:
I have a 4char matrix.
And I would like a sphere walking on its edges;
Meanning I have to make a three planes position float32 matrix from my argb matrix…

Any idea from anyone ?

#51191
Jul 4, 2010 at 10:55am

Thanks to xray cell.value, I can do almost what I want:
But still a problem, values are not sorted, so my sphere is going left to right all the time… (see the patch because it can’t be understandable !)
I’ve tried xray quicksort without any results…

Here’s my patch, and jpeg (load it into the patch to see its edges):

max v2;
#N vpatcher 0 44 1680 1046;
#P window setfont “Sans Serif” 9.;
#P newex 775 863 61 196617 pak 0. 0. 0.;
#P newex 774 822 172 196617 unpack i i s f f f;
#P newex 694 764 53 196617 route cell;
#P number 1067 249 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 357 583 97 196617 getcell $1 $2 , bang;
#P number 466 676 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 454 709 98 196617 pak 0 0;
#P newex 755 897 83 196617 prepend position;
#P newex 755 916 209 196617 jit.gl.gridshape cellvalue @scale 0.1 0.1 0.1;
#P toggle 568 516 15 0;
#P message 544 545 49 196617 adapt $1;
#P newex 465 609 214 196617 jit.matrix sample 3 float32 1 1920 @adapt 1;
#P newex 463 561 68 196617 jit.transpose;
#P message 243 698 61 196617 4164 1;
#P message 117 694 60 196617 3;
#P newex 243 672 60 196617 prepend set;
#P newex 117 650 199 196617 route planecount type dim;
#P newex 117 672 60 196617 prepend set;
#P newex 117 627 70 196617 jit.matrixinfo;
#B color 5;
#P window linecount 2;
#P comment 255 621 148 196617 outputs the planecount type and dimensions of the input matrix;
#P window linecount 1;
#P newex 114 311 48 196617 loadbang;
#N vpatcher 62 381 370 647;
#P window setfont “Sans Serif” 9.;
#P newex 202 135 33 196617 / -2.;
#P newex 163 135 27 196617 / 2.;
#P newex 163 156 61 196617 pak 0. 0. 0.;
#P newex 202 114 31 196617 r glh;
#P newex 163 114 34 196617 r glw;
#P newex 38 182 124 196617 jit.op @op – @val 0. 0. 0.;
#P newex 142 83 61 196617 pak 0. 0. 0.;
#P window linecount 1;
#P newex 187 56 45 196617 / -240.;
#P window linecount 0;
#P newex 142 56 40 196617 / 320.;
#P window linecount 1;
#P newex 187 35 31 196617 r glh;
#P newex 142 35 34 196617 r glw;
#P window linecount 0;
#P newex 38 104 114 196617 jit.op @op * @val 1. 1.;
#P outlet 38 208 15 0;
#P inlet 38 69 15 0;
#P connect 0 0 2 0;
#P connect 2 0 8 0;
#P connect 8 0 1 0;
#P connect 3 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 2 1;
#P fasten 11 0 8 1 168 176 157 176;
#P connect 9 0 12 0;
#P connect 12 0 11 0;
#P fasten 6 0 7 1 192 78 172 78;
#P connect 4 0 6 0;
#P fasten 13 0 11 1 207 154 193 154;
#P connect 10 0 13 0;
#P pop;
#P newobj 465 523 58 196617 p Pixel2GL;
#P newex 465 373 142 196617 jit.matrix 1 float32 320 240;
#P newex 465 394 40 196617 t b b l;
#P newex 465 462 53 196617 jit.pack 3;
#P newex 486 422 94 196617 jit.matrix Y-coord;
#P newex 465 442 94 196617 jit.matrix X-coord;
#P button 114 333 15 0;
#P newex 140 394 94 196617 jit.matrix Y-coord;
#P newex 114 414 94 196617 jit.matrix X-coord;
#P newex 114 373 63 196617 jit.unpack 2;
#P newex 114 352 283 196617 jit.gencoord 2 float32 320 240 @scale 320 240 @offset 0 0;
#P newex 448 327 27 196617 t l l;
#P newex 465 489 148 196617 xray.jit.contourmap @levels 1;
#P newex 465 352 66 196617 jit.rgb2luma;
#P message 511 284 57 196617 read , bang;
#P newex 448 307 103 196617 jit.qt.movie 320 240;
#P newex 75 102 55 196617 delay 100;
#P newex 75 80 48 196617 loadbang;
#P window setfont “Sans Serif” 10.;
#P comment 320 224 38 196618 height;
#B frgb 178 180 167;
#P comment 165 224 32 196618 width;
#B frgb 178 180 167;
#P window setfont “Sans Serif” 9.;
#P newex 517 652 258 196617 jit.gl.mesh cellvalue @draw_mode lines @color 1 1 1 1;
#P newex 261 243 31 196617 s glh;
#P newex 198 243 34 196617 s glw;
#P flonum 198 224 59 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 261 224 59 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 3;
#P message 75 125 72 196617 getdest_dim , getcamera , getlens_angle;
#P window linecount 1;
#N vpatcher 385 97 759 364;
#P outlet 131 150 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 131 128 29 196617 * 1.;
#P window linecount 1;
#P message 270 77 20 196617 $2;
#P message 248 77 20 196617 $1;
#P newex 248 95 32 196617 / 1.;
#P message 101 70 20 196617 $3;
#P newex 50 92 184 196617 expr $f2*2*tan($f1/2*3.1415/180);
#P newex 50 50 164 196617 route lens_angle camera dest_dim;
#P inlet 50 30 15 0;
#P outlet 166 152 15 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 2 1 4 0;
#P fasten 3 0 8 0 55 115 136 115;
#P connect 8 0 9 0;
#P fasten 5 0 8 1 253 118 155 118;
#P fasten 3 0 0 0 55 115 171 115;
#P fasten 4 0 3 1 106 88 229 88;
#P fasten 2 2 6 0 157 73 253 73;
#P connect 6 0 5 0;
#P fasten 2 2 7 0 157 73 275 73;
#P connect 7 0 5 1;
#P pop;
#P newobj 254 199 76 196617 p CalcGLHeight;
#P newex 258 126 227 196617 jit.window cellvalue @depthbuffer 1 @floating 1;
#P message 216 126 34 196617 reset;
#P newex 216 147 208 196617 jit.gl.handle cellvalue @inherit_transform 1;
#P toggle 155 107 15 0;
#P newex 155 126 57 196617 qmetro 60;
#P newex 155 147 50 196617 t b erase;
#P newex 155 179 108 196617 jit.gl.render cellvalue;
#P comment 951 250 112 196617 Walking in edge avenue:;
#P connect 17 0 18 0;
#P connect 18 0 9 0;
#P connect 35 0 28 0;
#P connect 28 0 24 0;
#P connect 24 0 25 0;
#P connect 25 0 26 0;
#P connect 22 0 37 0;
#P connect 37 0 39 0;
#P connect 39 0 38 0;
#P connect 38 0 41 0;
#P connect 25 1 27 0;
#P fasten 17 0 4 0 80 99 160 99;
#P connect 4 0 3 0;
#P connect 3 0 2 0;
#P fasten 2 1 1 0 200 175 160 175;
#P fasten 2 0 1 0 160 171 160 171;
#P fasten 9 0 1 0 80 175 160 175;
#P fasten 5 0 1 0 221 175 160 175;
#P fasten 8 0 11 0 259 220 203 220;
#P connect 11 0 12 0;
#P connect 6 0 5 0;
#P connect 39 2 40 0;
#P connect 40 0 42 0;
#P connect 1 1 8 0;
#P fasten 8 1 10 0 325 220 266 220;
#P connect 10 0 13 0;
#P connect 49 0 51 0;
#P fasten 20 0 19 0 516 303 453 303;
#P connect 19 0 23 0;
#P connect 50 0 49 0;
#P connect 34 0 43 0;
#P connect 23 1 21 0;
#P connect 21 0 33 0;
#P connect 33 0 32 0;
#P connect 32 0 29 0;
#P connect 29 0 31 0;
#P connect 31 0 22 0;
#P connect 22 0 34 0;
#P connect 51 0 44 0;
#P connect 45 0 44 0;
#P connect 43 0 44 0;
#P fasten 32 1 30 0 485 416 491 416;
#P connect 30 0 31 1;
#P connect 32 2 31 2;
#P connect 44 0 14 0;
#P connect 52 0 49 1;
#P connect 46 0 45 0;
#P connect 44 1 53 0;
#P connect 55 0 48 0;
#P connect 48 0 47 0;
#P connect 53 0 54 0;
#P connect 54 3 55 0;
#P connect 54 4 55 1;
#P connect 54 5 55 2;
#P pop;

[attachment=136116,767]

Attachments:
  1. Rond_noir.jpg
#183575
Jul 13, 2010 at 8:37am

up

#183576

You must be logged in to reply to this topic.