#N canvas 550 64 1236 825 10;
#X declare -lib Gem;
#X obj 76 85 gemhead;
#X msg 858 41 color 1 0 0;
#X obj 431 314 openpanel;
#X obj 431 291 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000;
#X obj 412 263 gemhead 11;
#X obj 412 237 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1;
#X text 956 108 1) turn on rendering;
#X obj 653 314 openpanel;
#X obj 653 293 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000;
#X obj 636 237 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 412 681 translateXYZ -2 0 0;
#X obj 636 683 translateXYZ 2 0 0;
#X obj 93 315 openpanel;
#X obj 93 294 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000;
#X msg 431 339 set open \$1 \, bang;
#X msg 93 336 set open \$1 \, bang;
#X msg 653 337 set open \$1 \, bang;
#X obj 636 262 gemhead 22;
#X msg 431 363 open ../data/img2.jpg;
#X msg 653 361 open ../data/img3.jpg;
#X msg 93 361 open ../data/img1.jpg;
#X obj 76 393 pix_image ../data/img1.jpg;
#X text 395 26 This is an example of multitexturing \, this shader mixes 2 textures;
#N canvas 87 154 247 179 Gem.init 0;
#X obj 118 46 loadbang;
#X msg 118 81 reset;
#X obj 118 113 outlet;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X restore 888 65 pd Gem.init;
#N canvas 340 107 682 322 gemwin 0;
#X obj 102 122 tgl 15 0 \$0-gemstart \$0-gemstart empty 17 7 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 102 161 r \$0-gemstart;
#X obj 102 182 select 1 0;
#X msg 102 214 create \, 1;
#X msg 177 215 destroy;
#X obj 102 239 t a;
#X obj 318 54 inlet;
#X obj 318 255 gemwin;
#X obj 318 100 t a a;
#X obj 318 287 outlet;
#X obj 350 128 route create destroy;
#X obj 350 150 t b;
#X msg 350 172 1;
#X obj 390 150 t b;
#X msg 390 172 0;
#X obj 350 195 t f;
#X msg 350 219 set \$1;
#X text 118 122 rendering;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 2 1 4 0;
#X connect 3 0 5 0;
#X connect 4 0 5 0;
#X connect 5 0 8 0;
#X connect 6 0 8 0;
#X connect 7 0 9 0;
#X connect 8 0 7 0;
#X connect 8 1 10 0;
#X connect 10 0 11 0;
#X connect 10 1 13 0;
#X connect 11 0 12 0;
#X connect 12 0 15 0;
#X connect 13 0 14 0;
#X connect 14 0 15 0;
#X connect 15 0 16 0;
#X connect 16 0 0 0;
#X coords 0 -1 1 1 85 40 1 100 100;
#X restore 858 82 pd gemwin;
#X obj 853 7 declare -lib Gem;
#X obj 820 505 tgl 18 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X msg 299 455 rectangle \$1;
#X obj 272 79 tgl 18 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 158 126 sel 0 1;
#X text 303 80 mode rectangle (in rectangle mode \, texture coordinates go from 0 to pixel_size - 1);
#X msg 269 249 MyTex0 0 \, MyTex1 1;
#X msg 158 152 open shader/multitexture;
#X msg 177 183 open shader/multitexture_rect;
#X obj 412 495 pix_resize 123 456;
#X obj 636 497 pix_resize 789 654;
#X obj 412 392 pix_image ../data/img2.jpg;
#X obj 636 388 pix_image ../data/img3.jpg;
#X msg 446 419 dimen 512 512;
#X msg 649 421 dimen 512 512;
#X msg 464 466 dimen 123 333;
#X msg 658 447 dimen 256 256;
#X msg 670 472 dimen 123 333;
#X msg 457 444 dimen 256 256;
#X obj 76 499 pix_resize 123 456;
#X msg 110 423 dimen 512 512;
#X msg 128 470 dimen 123 333;
#X msg 121 448 dimen 256 256;
#X text 74 712 legacy code works only for power-of-2 image sizes in "rectangle 0" mode. In "rectangle 1" mode \, legacy code works only if all the images have the same size. Anything else needs a manual coordinate correction., f 73;
#X obj 272 120 t a a;
#X obj 299 578 t a a a;
#X obj 76 658 scaleXYZ 3 3 1;
#X obj 76 233 glsl shader/multitexture \; MyTex0 0 \; MyTex1 1;
#X obj 76 604 pix_texture \; rectangle 0 \; texunit 2;
#X obj 412 617 pix_texture \; rectangle 0 \; texunit 0;
#X obj 636 620 pix_texture \; rectangle 0 \; texunit 1;
#X obj 76 688 square;
#X msg 820 534 matrixcoord \$1;
#X text 848 485 0 : legacy : all TextureMatrix are set to identity;
#X text 848 504 1 : Use TextureMatrix to adapt the textures size;
#X text 72 763 The matrixcoord option allows the shader to fill a transformation matrix used to correct the texture coordinate \, in case of multitexture., f 72;
#X connect 0 0 52 0;
#X connect 1 0 24 0;
#X connect 2 0 14 0;
#X connect 3 0 2 0;
#X connect 4 0 36 0;
#X connect 5 0 4 0;
#X connect 7 0 16 0;
#X connect 8 0 7 0;
#X connect 9 0 17 0;
#X connect 12 0 15 0;
#X connect 13 0 12 0;
#X connect 14 0 18 0;
#X connect 15 0 20 0;
#X connect 16 0 19 0;
#X connect 17 0 37 0;
#X connect 18 0 36 0;
#X connect 19 0 37 0;
#X connect 20 0 21 0;
#X connect 21 0 44 0;
#X connect 23 0 24 0;
#X connect 26 0 57 0;
#X connect 27 0 50 0;
#X connect 28 0 49 0;
#X connect 29 0 32 0;
#X connect 29 1 33 0;
#X connect 31 0 52 1;
#X connect 32 0 52 0;
#X connect 33 0 52 0;
#X connect 34 0 54 0;
#X connect 35 0 55 0;
#X connect 36 0 34 0;
#X connect 37 0 35 0;
#X connect 38 0 34 0;
#X connect 39 0 35 0;
#X connect 40 0 34 0;
#X connect 41 0 35 0;
#X connect 42 0 35 0;
#X connect 43 0 34 0;
#X connect 44 0 53 0;
#X connect 45 0 44 0;
#X connect 46 0 44 0;
#X connect 47 0 44 0;
#X connect 49 0 29 0;
#X connect 49 1 27 0;
#X connect 50 0 53 0;
#X connect 50 1 54 0;
#X connect 50 2 55 0;
#X connect 51 0 56 0;
#X connect 52 0 21 0;
#X connect 52 1 31 0;
#X connect 53 0 51 0;
#X connect 54 0 10 0;
#X connect 55 0 11 0;
#X connect 57 0 50 0;
