#N canvas 583 -3 886 875 10;
#X declare -lib Gem;
#X obj 465 38 cnv 15 420 820 empty empty empty 20 12 0 14 #dce4fc #404040 0;
#X obj 472 554 cnv 15 100 30 empty empty empty 20 12 0 14 #b8b8b8 #404040 0;
#X obj 474 48 cnv 15 400 480 empty empty empty 20 12 0 14 #14e814 #404040 0;
#X obj 477 71 gemhead 20;
#X obj 664 569 gemhead;
#X msg 615 136 dimen 320 240;
#X obj 477 731 rotateXYZ;
#X floatatom 794 690 5 0 0 0 - - - 0;
#X msg 762 119 color 0 0 1 0;
#X msg 602 117 dimen 1024 1024;
#X msg 751 79 color 0 0 0 0;
#X obj 477 685 t a b;
#X floatatom 717 732 5 0 0 0 - - - 0;
#X msg 527 303 rectangle \$1;
#X obj 527 283 tgl 18 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 0 1;
#X msg 509 131 type FLOAT;
#X obj 664 549 tgl 18 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 0 1;
#X obj 477 645 translateXYZ 0 0 -4;
#X obj 477 561 gemframebuffer;
#X obj 664 594 pix_texture;
#X obj 664 621 t a b;
#X msg 509 258 texunit \$1;
#X msg 495 92 type BYTE;
#X msg 503 112 type INT;
#X msg 658 239 format YUV;
#X msg 649 218 format RGB;
#X msg 668 260 format RGBA;
#X msg 680 280 format RGB32;
#X obj 664 750 square 2;
#X obj 664 712 rotateXYZ -40 0 200;
#X floatatom 707 692 5 0 0 0 - - - 0;
#X obj 477 751 pqtorusknots;
#N canvas 0 50 450 300 rotation 0;
#X obj 33 19 inlet;
#X obj 33 110 % 360;
#X obj 33 62 i;
#X obj 33 88 + 5;
#X obj 33 136 outlet;
#X obj 84 111 % 360;
#X obj 84 63 i;
#X obj 84 137 outlet;
#X obj 134 112 % 360;
#X obj 134 64 i;
#X obj 134 138 outlet;
#X obj 84 89 + 3;
#X obj 134 90 + 7;
#X connect 0 0 2 0;
#X connect 0 0 6 0;
#X connect 0 0 9 0;
#X connect 1 0 2 1;
#X connect 1 0 4 0;
#X connect 2 0 3 0;
#X connect 3 0 1 0;
#X connect 5 0 6 1;
#X connect 5 0 7 0;
#X connect 6 0 11 0;
#X connect 8 0 9 1;
#X connect 8 0 10 0;
#X connect 9 0 12 0;
#X connect 11 0 5 0;
#X connect 12 0 8 0;
#X restore 504 706 pd rotation;
#X floatatom 509 238 5 0 0 0 - - - 0;
#N canvas 125 50 450 300 rotation 0;
#X obj 112 29 inlet;
#X obj 112 105 % 360;
#X obj 112 57 i;
#X obj 112 131 outlet;
#X obj 112 83 + 1;
#X connect 0 0 2 0;
#X connect 1 0 2 1;
#X connect 1 0 3 0;
#X connect 2 0 4 0;
#X connect 4 0 1 0;
#X restore 794 665 pd rotation;
#X obj 762 99 loadbang;
#X obj 477 665 color 1 0 0;
#X obj 649 305 t a;
#X obj 585 154 t a;
#X obj 751 165 t a;
#X obj 495 160 t a;
#X floatatom 563 624 5 0 0 0 - - - 0;
#X floatatom 607 625 5 0 0 0 - - - 0;
#X floatatom 520 624 5 0 0 0 - - - 0;
#X obj 495 184 t a;
#X obj 470 790 cnv 15 410 60 empty empty empty 20 12 0 14 #bcbcbc #404040 0;
#X msg 706 818 color 0 0 0 0;
#X msg 706 798 color 0 1 1 0;
#X msg 597 801 lighting \$1;
#X obj 575 801 tgl 18 0 empty empty empty 0 -6 0 8 #fcfcfc #000000 #000000 0 1;
#X obj 597 828 t a;
#X text 476 52 Example:;
#X text 699 10 GEM object;
#X obj 7 71 cnv 15 450 130 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#X obj 7 238 cnv 15 450 620 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#X text 10 294 Inlets:;
#X obj 7 205 cnv 15 450 30 empty empty empty 20 12 0 14 #bcbcbc #404040 0;
#X text 14 204 Arguments:;
#X text 30 313 Inlet 1: gemlist;
#X text 23 238 Outlets:;
#X text 30 253 Outlet 1: gemlist;
#X text 60 217 <none>;
#X text 102 29 Synopsis: [gemframebuffer];
#X text 122 45 Class: framebuffer object;
#X text 12 80 Description: Renders a scene in a texture \, for later use.;
#X text 12 98 this example renders a scene (pqtorusknots) into a framebuffer \, which is then used as a texture onto a square., f 72;
#X text 13 128 you need framebuffer support (and its driver) on your gfx-card, f 72;
#X text 30 327 Inlet 1: message: type [BYTE | INT | FLOAT];
#X text 30 395 Inlet 1: message: dimen <x> <y>;
#X text 30 429 Inlet 1: message: color <r> <g> <b> <a>;
#X text 30 510 Inlet 1: message: texunit <f>;
#X text 30 465 Inlet 1: message: rectangle [0|1];
#X text 103 342 (type of the framebuffer data);
#X text 102 410 (dimension of the framebuffer texture);
#X text 106 545 (useful only with shader);
#X text 106 528 (change texunit of the texture);
#X text 104 482 (texturing mode \; rectangle (1) or normalized (0));
#X text 100 376 (color format of the framebuffer);
#X text 102 445 (background color of the framebuffer);
#X obj 546 71 tgl 18 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1;
#X floatatom 493 586 5 0 0 0 - - - 0;
#X obj 477 605 scaleXYZ;
#X floatatom 563 589 5 0 0 0 - - - 0;
#X floatatom 528 588 5 0 0 0 - - - 0;
#X msg 585 60 perspec -1 1 -1 1 1 20;
#X msg 593 86 perspec -1 1 -1 1 3 75;
#X text 98 577 (frustum of the framebuffer);
#X text 752 59 default;
#X text 11 153 NOTE: the default view-point of [gemframebuffer] is at the origin 0/0/0 \, unlike [gemwin] where it is at 0/0/4. You might want to manually insert a [translateXYZ 0 0 -4]., f 72;
#N canvas 484 243 450 300 META 0;
#X obj 10 25 declare -lib Gem;
#X text 10 45 DESCRIPTION Renders a scene in a texture \, for later use.;
#X text 10 65 KEYWORDS Gem framebuffer;
#X text 20 85 INLET_0 gemlist type format dimen color rectangle texunit perspec;
#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 778 8 pd META;
#X text 30 562 Inlet 1: message: perspec <left><right><bottom><top><near><far>, f 66;
#X msg 685 300 format RGBA32F;
#X text 30 360 Inlet 1: message: format [RGB|RGBA|RGB32|RGBA32F|YUV];
#X obj 475 799 _gemwin;
#X obj 809 823 world_light;
#X obj 809 800 gemhead 1;
#X msg 672 352 quality \$1;
#X msg 685 392 repeat \$1;
#X obj 672 332 tgl 18 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 685 372 tgl 18 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X obj 649 487 t a;
#X msg 700 442 clear \$1;
#X obj 700 422 tgl 18 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X text 30 595 Inlet 1: message: clear [0|1] (default : 1);
#X text 65 612 0 to disable the clearing of the color and depth buffer at every rendering;
#X text 30 640 Inlet 1: message: quality [0|1];
#X text 76 656 GL_NEAREST (default) | GL_LINEAR;
#X text 73 671 (useful only with a direct access from a shader);
#X text 73 715 (useful only with a direct access from a shader);
#X text 30 684 Inlet 1: message: repeat [0|1];
#X text 75 699 CLAMP_TO_EDGE (default) or REPEAT;
#X obj 543 329 tgl 18 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000 0 1;
#X msg 543 349 verbose \$1;
#X text 30 734 Inlet 1: message: verbose [0|1];
#X text 31 271 Outlet 2: texture info : <id> <width> <height> <type> <upsidedown>, f 67;
#X text 75 749 verbose printout when rebuilding the framebuffer or not (default is non-verbose);
#X obj 495 486 t a;
#X msg 564 402 MSAA \$1;
#X floatatom 564 378 5 0 0 0 - - - 0;
#X text 28 789 Inlet 1: message MSAA int;
#X text 77 805 Multi Sample Anti Aliasing;
#X text 75 822 Allow anti aliasing in a framebuffer;
#X connect 3 0 18 0;
#X connect 4 0 19 0;
#X connect 5 0 38 0;
#X connect 6 0 31 0;
#X connect 7 0 29 3;
#X connect 8 0 39 0;
#X connect 9 0 38 0;
#X connect 10 0 39 0;
#X connect 11 0 6 0;
#X connect 11 1 32 0;
#X connect 12 0 28 1;
#X connect 13 0 116 0;
#X connect 14 0 13 0;
#X connect 15 0 40 0;
#X connect 16 0 4 0;
#X connect 17 0 36 0;
#X connect 18 0 81 0;
#X connect 18 1 19 1;
#X connect 19 0 20 0;
#X connect 20 0 29 0;
#X connect 20 1 34 0;
#X connect 22 0 40 0;
#X connect 23 0 40 0;
#X connect 24 0 37 0;
#X connect 25 0 37 0;
#X connect 26 0 37 0;
#X connect 27 0 37 0;
#X connect 29 0 28 0;
#X connect 30 0 29 1;
#X connect 32 0 6 1;
#X connect 32 1 6 2;
#X connect 32 2 6 3;
#X connect 33 0 21 0;
#X connect 33 0 116 0;
#X connect 34 0 7 0;
#X connect 35 0 8 0;
#X connect 36 0 11 0;
#X connect 37 0 100 0;
#X connect 38 0 44 0;
#X connect 39 0 44 0;
#X connect 40 0 44 0;
#X connect 41 0 17 2;
#X connect 42 0 17 3;
#X connect 43 0 17 1;
#X connect 44 0 116 0;
#X connect 46 0 50 0;
#X connect 47 0 50 0;
#X connect 48 0 50 0;
#X connect 49 0 48 0;
#X connect 50 0 93 0;
#X connect 79 0 3 0;
#X connect 80 0 81 1;
#X connect 81 0 17 0;
#X connect 82 0 81 3;
#X connect 83 0 81 2;
#X connect 84 0 38 0;
#X connect 85 0 38 0;
#X connect 91 0 37 0;
#X connect 95 0 94 0;
#X connect 96 0 100 0;
#X connect 97 0 100 0;
#X connect 98 0 96 0;
#X connect 99 0 97 0;
#X connect 100 0 18 0;
#X connect 101 0 100 0;
#X connect 102 0 101 0;
#X connect 111 0 112 0;
#X connect 112 0 116 0;
#X connect 116 0 18 0;
#X connect 117 0 116 0;
#X connect 118 0 117 0;
