#N canvas 43 61 647 834 10;
#X declare -lib Gem;
#X text 452 8 GEM object;
#X obj 8 392 cnv 15 430 360 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#X text 19 394 Inlets:;
#X text 22 665 Outlets:;
#X obj 8 352 cnv 15 430 30 empty empty empty 20 12 0 14 #bcbcbc #404040 0;
#X text 17 351 Arguments:;
#X obj 8 56 cnv 15 430 285 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#X obj 448 77 cnv 15 170 600 empty empty empty 20 12 0 14 #dce4fc #404040 0;
#X text 454 60 Example:;
#X obj 514 612 cnv 15 100 60 empty empty empty 20 12 0 14 #bcbcbc #404040 0;
#X obj 454 276 cnv 15 160 300 empty empty empty 20 12 0 14 #14e814 #404040 0;
#X obj 454 84 gemhead;
#X text 71 31 Class: pix object;
#X obj 513 85 bng 15 250 50 0 empty empty pix_load 20 8 0 8 #fcfcfc #000000 #000000;
#N canvas 0 50 587 366 image 0;
#X obj 77 48 inlet;
#X obj 77 344 outlet;
#X obj 77 205 pix_image examples/data/fractal.JPG;
#X obj 223 55 inlet;
#X msg 223 123 open \$1;
#X obj 223 100 openpanel;
#X text 312 85 re-send the image to the [pix_]-object;
#X text 231 37 open;
#X text 79 30 gemlist;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 3 0 5 0;
#X connect 4 0 2 0;
#X connect 5 0 4 0;
#X restore 454 113 pd image;
#X obj 454 547 pix_texture;
#X text 63 362 <none>;
#X text 57 682 Outlet 1: gemlist;
#X text 29 408 Inlet 1: gemlist;
#X obj 454 591 square 3;
#X text 519 105 open an image;
#X text 512 118 (JPEG \, TIFF \, ..);
#X text 50 12 Synopsis: [pix_texture];
#X text 29 57 Description: apply texture mapping;
#X text 16 79 enables texture mapping with the current pix. Whatever pix values are in the network currently will be used (ie \, all processing after the pix_texture will not have any effect)., f 69;
#X msg 461 451 quality \$1;
#X obj 461 432 tgl 15 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 0 1;
#X text 29 423 Inlet 1: 0|1 turn texturing On/off;
#X text 29 437 Inlet 1: quality 0|1 : GL_NEAREST | GL_LINEAR(default);
#X text 16 122 Send a quality message to change the quality of the texture mapping. GL_LINEAR is better than GL_NEAREST (but also more computationally expensive). However \, on many machines (especially SGIs) \, there is no speed difference., f 69;
#X text 14 233 [pix_texture] is able to texture images of ANY size (even non-power of 2), f 54;
#X obj 532 472 tgl 15 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 0 1;
#X msg 532 491 rectangle \$1;
#X obj 469 497 tgl 15 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 0 1;
#X obj 532 432 tgl 15 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 0 1;
#X msg 469 516 client_storage \$1;
#X msg 532 451 repeat \$1;
#X text 29 453 Inlet 1: repeat 0|1 : CLAMP_TO_EDGE or REPEAT(default);
#X text 28 470 Inlet 1: rectangle 0|1 : use rectangle-texturing if available (default:1);
#X text 28 498 Inlet 1: client_storage 0|1 : use client-storage if available (default:1);
#X msg 493 407 env \$1;
#X obj 493 387 hradio 15 1 0 6 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 0;
#X obj 474 222 pack 0 0 1;
#X obj 454 243 color 0 0.5 0;
#X obj 500 196 t b f;
#X obj 501 177 nbx 3 14 0 1 0 0 empty empty green 0 -6 0 10 #fcfcfc #000000 #000000 0 256;
#X obj 542 196 t b f;
#X obj 543 177 nbx 3 14 0 1 0 0 empty empty blue 0 -6 0 10 #fcfcfc #000000 #000000 0 256;
#X obj 460 196 nbx 3 14 0 1 0 0 empty empty red 0 -6 0 10 #fcfcfc #000000 #000000 0 256;
#X text 16 262 [pix_texture] tries to use the fastest way to get a pix onto a texture. This implies using "rectangle"-texturing if available. This \, in turn \, can lead to some problems with several geos. Try using "rectangle 0" if you experience problems. Rectangle textures cannot be REPEATed (they are always clamped-to-edge), f 69;
#X text 28 526 Inlet 1: env 0|1|2|3|4|5 : texture environment mode;
#X text 53 541 0=GL_REPLACE \, 1=GL_DECAL \, 2=GL_BLEND \, 3=GL_ADD \,;
#X text 53 556 4=GL_COMBINE \, >4=GL_MODULATE (default);
#X text 16 176 - env message changes the texture environment mode. Some modes allow mixing with fragment colors (BLEND \, ADD \, COMBINE \, MODULATE) \, while REPLACE and DECAL ignore the current fragment/texture color., f 69;
#X text 459 149 set base fragment color;
#X text 57 700 Outlet 2: texture info : <id> <width> <height> <type> <upsidedown flag>;
#X text 28 576 Inlet 1: message: texunit <f>;
#X text 108 611 (useful only with shader);
#X text 108 594 (change texunit of the texture);
#X floatatom 463 286 5 0 0 0 - - - 0;
#X msg 463 305 texunit \$1;
#X obj 473 331 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1;
#X msg 473 351 yuv \$1;
#X text 28 646 Inlet 1: message: pbo : change pixel buffer object number;
#X floatatom 537 332 5 0 0 0 - - - 0;
#X msg 537 351 pbo \$1;
#X text 28 626 Inlet 1: message: yuv : use native YUV-mode if available (default:1), f 69;
#N canvas 484 243 450 300 META 0;
#X obj 10 25 declare -lib Gem;
#X text 10 45 DESCRIPTION apply texture mapping;
#X text 10 65 KEYWORDS Gem pix image;
#X text 20 85 INLET_0 gemlist bool quality repeat rectangle client_storage env texunit yuv pbo;
#X text 20 105 OUTLET_0 gemlist;
#X text 20 125 OUTLET_1 texture;
#X text 10 145 AUTHOR IOhannes m zmölnig;
#X text 10 165 LICENSE GPL v2;
#X restore 518 8 pd META;
#X obj 521 618 _gemwin;
#X obj 257 781 _pix2rectangle;
#X text 43 760 For the sake of brevity \, most Gem-helppatches use a small wrapper abstraction around [pix_texture]+[rectangle]:, f 77;
#X connect 11 0 14 0;
#X connect 13 0 14 1;
#X connect 14 0 43 0;
#X connect 15 0 19 0;
#X connect 25 0 15 0;
#X connect 26 0 25 0;
#X connect 31 0 32 0;
#X connect 32 0 15 0;
#X connect 33 0 35 0;
#X connect 34 0 36 0;
#X connect 35 0 15 0;
#X connect 36 0 15 0;
#X connect 40 0 15 0;
#X connect 41 0 40 0;
#X connect 42 0 43 1;
#X connect 43 0 15 0;
#X connect 44 0 42 0;
#X connect 44 1 42 1;
#X connect 45 0 44 0;
#X connect 46 0 42 0;
#X connect 46 1 42 2;
#X connect 47 0 46 0;
#X connect 48 0 42 0;
#X connect 59 0 60 0;
#X connect 60 0 15 0;
#X connect 61 0 62 0;
#X connect 62 0 15 0;
#X connect 64 0 65 0;
#X connect 65 0 15 0;
