Forums > Jitter

layering

December 14, 2009 | 11:46 pm

hi

bit stuck on what I’m pretty sure is a small problem, I’m just trying to layer some particles in front of a videoplane. Usually I’d use @layer but since the particles render straight to the jit.gl.render I’m unsure how this should be done. Can you use two jit.gl.render object per jit.windeow? Does @layer work in jit.gl.render? Below is what I have so far.

Thanks in advance
Garrett

max v2;
#N vpatcher 523 44 1130 641;
#P origin -221 -112;
#P window setfont "Sans Serif" 9.;
#P newex 102 204 50 196617 loadbang;
#P message 252 368 50 196617 triangles;
#P newex 102 227 104 196617 pak position -1. 1. 4.;
#P window linecount 2;
#P newex 100 253 356 196617 jit.gl.videoplane visualiser @client_storage 1 @blend_enable 1 @scale 1.333 1. 1. @depth_enable 0 @lighting_enable 0 @position 0. 0. -4. @layer 1;
#B color 5;
#P window linecount 1;
#P message 214 63 14 196617 1;
#P newex 214 41 48 196617 loadbang;
#P toggle 214 86 15 0;
#P newex 214 109 52 196617 metro 20;
#P newex 215 131 98 196617 forward cpu_metro;
#N vpatcher 482 461 1347 860;
#P origin 274 -78;
#P window setfont "Sans Serif" 9.;
#P message 245 132 68 196617 fullscreen $1;
#P toggle 228 132 15 0;
#P newex 270 107 35 196617 sel 27;
#P newex 228 107 40 196617 key;
#P outlet 787 333 15 0;
#P window setfont "Fixedwidth Serif" 10.;
#P message 787 99 14 1441802 1;
#P inlet 591 39 15 0;
#P inlet 478 39 15 0;
#P window setfont "Sans Serif" 9.;
#P comment 530 40 67 196617 Doublebuffer;
#P comment 420 40 63 196617 Depthbuffer;
#P message 478 87 75 196617 depthbuffer $1;
#P message 591 87 79 196617 doublebuffer $1;
#P outlet 771 333 15 0;
#P comment 729 334 47 196617 Defaults;
#P window setfont "Fixedwidth Serif" 10.;
#P message 771 99 14 1441802 0;
#P window setfont "Sans Serif" 9.;
#P newex 771 38 56 196617 r loadbang;
#P comment 259 190 116 196617 Main Visualiser window;
#P newex 259 169 339 196617 jit.window visualiser @rect 10 50 740 636 @idlemouse 1 @fsmenubar 0;
#P fasten 15 0 16 0 275 129 233 129;
#P fasten 16 0 17 0 244 147 244 132;
#P connect 17 0 0 0;
#P fasten 6 0 0 0 596 164 264 164;
#P fasten 7 0 0 0 483 162 264 162;
#P fasten 14 0 15 0 269 124 269 109;
#P connect 10 0 7 0;
#P connect 11 0 6 0;
#P connect 2 0 3 0;
#P connect 3 0 5 0;
#P fasten 2 0 12 0 776 95 792 95;
#P connect 12 0 13 0;
#P pop;
#P newobj 188 193 89 196617 p windowcontrols;
#P window setfont "Gill Sans" 10.;
#P comment 240 161 69 278003722 Doublebuffer;
#B frgb 100 100 100;
#P user jsui 242 174 41 15 1 0 0 jsui_texttoggle.js Off On 0 0 0 240 240 240 "Geneva" 0.7 0.5 2;
#P comment 183 161 64 278003722 Depthbuffer;
#B frgb 100 100 100;
#P user jsui 185 174 41 15 1 0 0 jsui_texttoggle.js Off On 0 0 0 240 240 240 "Geneva" 0.7 0.5 2;
#P window setfont "Sans Serif" 9.;
#N vpatcher 57 269 374 773;
#P origin 385 -48;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 64 264 57 196617 r torender;
#P window linecount 0;
#P newex 168 252 40 196617 s stuff;
#P window setfont "Gill Sans" 10.;
#P comment 198 155 39 278003722 Metro;
#P window setfont "Sans Serif" 9.;
#P newex 198 169 66 196617 r cpu_metro;
#P outlet 227 435 15 0;
#P inlet 179 53 15 0;
#P comment 194 54 41 196617 On/Off;
#P comment 178 436 55 196617 Metro out;
#P newex 179 189 29 196617 gate;
#P newex 179 209 58 196617 t b erase b;
#P newex 25 292 189 196617 jit.gl.render visualiser @lens_angle 45.;
#P connect 10 0 0 0;
#P fasten 1 0 0 0 184 230 30 230;
#P fasten 1 1 0 0 208 232 30 232;
#P connect 1 2 9 0;
#P connect 5 0 2 0;
#P connect 2 0 1 0;
#P connect 7 0 2 1;
#P connect 1 2 6 0;
#P pop;
#P newobj 318 167 119 196617 p 3dspace;
#P window setfont "Sans Serif" 18.;
#P user jit.fpsgui 350 116 59 196626 0;
#P user jsui 415 133 40 20 1 0 0 jsui_texttoggle.js Off On 0 0 0 240 240 240 "Geneva" 0.7 0.5 2;
#P window setfont "Sans Serif" 9.;
#P message 296 494 14 196617 5;
#P message 281 494 14 196617 2;
#P message 259 494 20 196617 45;
#P newex 230 472 50 196617 loadbang;
#P message 231 494 26 196617 200;
#P message 308 368 76 196617 blend_enable 1;
#P newex 152 367 98 196617 pak blend_mode 1 5;
#N vpatcher 681 73 1252 797;
#P origin -128 11;
#P window setfont "Sans Serif" 9.;
#P newex 339 622 57 196617 s torender;
#P newex 163 291 50 196617 loadbang;
#P newex 212 561 45 196617 r grimy;
#P newex 322 388 156 196617 jit.matrix mess 5 float32 100 2;
#P message 386 469 48 196617 dim $1 1;
#P newex 164 312 106 196617 pak pos_var -2. 2. 0.;
#P newex 320 527 89 196617 jit.pack 3 float32;
#P newex 312 497 99 196617 jit.unpack 5 float32;
#P newex 261 497 50 196617 t erase b;
#P newex 280 432 100 196617 jit.split @splitdim 1;
#P newex 323 340 59 196617 jit.p.vishnu;
#B color 5;
#P comment 248 53 25 196617 Emit;
#P comment 379 53 25 196617 Life;
#P message 199 114 48 196617 dim $1 2;
#P newex 342 239 56 196617 jit.p.shiva;
#B color 5;
#P message 311 114 65 196617 emit_var $1;
#P message 248 114 43 196617 emit $1;
#P message 442 114 60 196617 life_var $1;
#P message 378 114 38 196617 life $1;
#P newex 367 215 156 196617 jit.matrix mess 5 float32 100 2;
#P newex 367 190 20 196617 t b;
#P newex 367 170 40 196617 r stuff;
#P inlet 378 67 15 0;
#P inlet 248 67 15 0;
#P inlet 199 67 15 0;
#P inlet 442 67 15 0;
#P inlet 311 67 15 0;
#P comment 354 68 29 196617 Max;
#P comment 398 68 49 196617 Variance;
#P comment 106 68 99 196617 Number of particles;
#P comment 224 68 29 196617 Max;
#P comment 267 68 49 196617 Variance;
#P connect 30 0 26 0;
#P connect 7 0 18 0;
#P connect 8 0 15 0;
#P connect 22 0 23 0;
#P connect 21 0 22 0;
#P connect 5 0 16 0;
#P connect 27 0 24 0;
#P connect 22 0 24 0;
#P connect 27 0 25 0;
#P connect 24 2 25 0;
#P connect 18 0 28 0;
#P connect 21 0 28 0;
#P connect 17 0 21 0;
#P connect 26 0 21 0;
#P connect 29 0 31 0;
#P connect 23 0 31 0;
#P connect 23 1 31 0;
#P connect 25 0 31 0;
#P fasten 12 0 17 0 372 235 347 235;
#P fasten 16 0 17 0 316 143 347 143;
#P fasten 15 0 17 0 253 145 347 145;
#P fasten 14 0 17 0 447 139 347 139;
#P fasten 13 0 17 0 383 137 347 137;
#P connect 24 3 25 1;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P fasten 18 0 12 0 204 168 347 168 347 210 372 210;
#P connect 9 0 13 0;
#P connect 7 0 27 0;
#P connect 24 4 25 2;
#P connect 6 0 14 0;
#P pop;
#P newobj 178 521 170 196617 p particlegenerator;
#P newex 51 366 99 196617 pak color 0. 0. 1. 1.;
#P message 342 399 82 196617 auto_material 1;
#P newex 82 431 43 196617 s grimy;
#P flonum 537 375 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 499 375 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 459 375 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 250 399 86 196617 lighting_enable 1;
#P newex 338 327 50 196617 loadbang;
#P newex 431 399 110 196617 pak position 0. 0. -10.;
#P window setfont "Sans Serif" 14.;
#P comment 457 133 114 196622 < Turn it all on;
#B color 14;
#P connect 2 0 9 0;
#P connect 1 0 7 0;
#P connect 8 0 7 0;
#P connect 9 0 7 0;
#P connect 3 0 7 0;
#P connect 12 0 7 0;
#P connect 33 0 7 0;
#P connect 11 0 7 0;
#P connect 32 0 31 0;
#P connect 34 0 32 0;
#P connect 2 0 11 0;
#P connect 13 0 10 0;
#P hidden connect 25 0 21 0;
#P hidden connect 21 0 25 0;
#P connect 29 0 30 0;
#P connect 30 0 28 0;
#P connect 28 0 27 0;
#P connect 27 0 26 0;
#P connect 17 0 10 1;
#P connect 14 0 13 0;
#P hidden connect 25 1 23 0;
#P connect 2 0 3 0;
#P connect 2 0 33 0;
#P connect 16 0 10 2;
#P connect 14 0 15 0;
#P hidden connect 23 0 25 1;
#P connect 14 0 16 0;
#P connect 14 0 17 0;
#P connect 15 0 10 3;
#P connect 2 0 12 0;
#P hidden connect 18 0 20 0;
#P connect 16 0 10 4;
#P connect 2 0 8 0;
#P hidden connect 20 0 19 0;
#P connect 2 0 1 0;
#P connect 4 0 1 1;
#P fasten 5 0 1 2 504 394 502 394;
#P fasten 6 0 1 3 542 394 535 394;
#P pop;


December 15, 2009 | 12:04 am

you can use a jit.gl.mesh instead of gl.render to draw your particle triangles. just set @draw_mode triangles, and send the particle matrix to the left-most inlet of gl.mesh. @layer will work fine in this case.


December 15, 2009 | 7:43 pm

Great, I was thinking I needed to render it to something but I had no idea what. Thanks for your help Robtherich.

Garrett


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