oops,
exactly the other way round. you have to set both explicitely to mode 0
see patch with added obects.
marius.

marius schebella wrote:
you have to attach a mode 1 to the left texture.
osx by default uses mode 0 (recangular)
and then set the mode for the framebuffer and the texture to 1,
or, change all sample2d to sample2dRect
marius.

vade wrote:
Thank you Cyrille - id love for this to work, but alas;

Under OS X 10.5.1 with PD 0.40.3-extended 20071117 I only see the square, no sphere:

http://abstrakt.vade.info/ILOVETHEPDLIST/gem_shader_framebuffer.jpg

Ill try playing with it to see what I can get.

Thanks a lot!

On Dec 8, 2007, at 9:50 AM, cyrille henry wrote:

hello,
In the recent discution on this list regarding gem an shader, i read that shader could not be used with framebuffer. i did not realize when i read this (and i can't find it anymore on the archieve). in fact it is not true.
shader has to be loaded before the framebuffer objet but it work.

here is an exemple of how to use a shader and render on the framebuffer and then using the framebuffer as a texture send to an other shader.

hope that help

Cyrille


< shader_and_framebuffer .zip>_______________________________________________
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list


_______________________________________________
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list




#N canvas 441 27 834 764 10;
#X obj 192 83 gemhead 20;
#X obj 481 166 gemhead;
#X floatatom 522 391 5 0 0 0 - - -;
#X floatatom 471 392 5 0 0 0 - - -;
#X obj 571 389 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
-262144 -1 -1 0 256;
#X msg 276 97 dim 320 240;
#X msg 276 117 dim 256 256;
#X floatatom 289 443 5 0 0 0 - - -;
#X floatatom 338 443 5 0 0 0 - - -;
#X floatatom 240 443 5 0 0 0 - - -;
#X obj -68 174 gemhead 1;
#X obj -68 194 world_light;
#X msg 276 137 dim 512 512;
#X obj -64 136 gemwin;
#X msg -74 76 destroy;
#X floatatom 497 322 5 0 0 0 - - -;
#X floatatom 572 333 5 0 0 0 - - -;
#X msg 279 45 color 0 0 1 0;
#X msg 276 157 dim 1024 1024;
#X msg 279 69 color 0 0 0 0;
#X obj 193 507 rotateXYZ;
#X floatatom 216 490 5 0 0 0 - - -;
#X floatatom 259 490 5 0 0 0 - - -;
#X floatatom 308 496 5 0 0 0 - - -;
#X msg 4 75 color 0 0 0 0;
#X msg -16 48 color 0 1 1 0;
#X floatatom 544 433 5 0 0 0 - - -;
#X obj 192 355 color 1 1 1;
#X obj 193 413 pix_texture;
#X msg 396 94 mode \$1;
#X obj 396 67 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X obj 193 467 translateXYZ -0.5 -0.8 -1;
#X floatatom 366 507 5 0 0 0 - - -;
#X msg 279 10 type FLOAT;
#X obj 450 131 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X floatatom 332 281 5 0 0 0 - - -;
#X obj 481 357 rotateXYZ 28 0 200;
#X obj 481 431 square 2;
#X obj 481 410 translateXYZ 0 0 1.53;
#X obj 192 281 translateXYZ 0 0 -4;
#X obj 192 135 color 0 1 0;
#X msg -64 8 reset \, create \, 1;
#X obj 169 195 cnv 15 400 60 empty empty empty 20 12 0 14 -233017 -66577
0;
#X obj 481 233 pix_texture;
#X obj 481 265 t a b;
#X obj 557 286 + 1;
#X obj 511 286 i 200;
#X obj 585 286 % 3600;
#X obj 572 313 / 10;
#X text 425 65 <-- click me to change between normalized(0) and rectangle(1)
textures.;
#X obj 194 531 sphere 2 33;
#N canvas 684 69 640 693 shader 0;
#X msg 29 80 print;
#X obj 74 442 glsl_program;
#X obj 147 311 pack 0 0;
#X msg 31 192 print;
#X obj 168 291 t b f;
#X obj 168 246 change;
#X obj 146 121 change;
#X msg 147 351 link \$1 \$2;
#X msg 98 413 print;
#X floatatom 168 272 2 0 0 0 ID - -;
#X floatatom 146 144 2 0 0 0 ID - -;
#X obj 165 372 print linking;
#X obj 74 226 glsl_fragment;
#X obj 74 102 glsl_vertex;
#X obj 124 59 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 74 24 alpha;
#X msg 88 80 open shader1.vert;
#X msg 85 196 open shader1.frag;
#X floatatom 361 352 5 0 0 0 - - -;
#X floatatom 365 401 5 0 0 0 - - -;
#N canvas 0 22 450 300 load_shader 0;
#X obj 89 99 t b b;
#X msg 119 126 0;
#X obj 89 154 outlet;
#X obj 89 71 gemhead 1;
#X connect 0 0 2 0;
#X connect 0 1 1 0;
#X connect 1 0 3 0;
#X connect 3 0 0 0;
#X restore 124 38 pd load_shader;
#N canvas 0 22 450 300 init_shader 0;
#X obj 89 154 outlet;
#X obj 89 45 inlet;
#X obj 89 73 change;
#X obj 89 100 t b;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 0 0;
#X restore 153 466 pd init_shader;
#X text 416 351 <- 2;
#X msg 361 373 K1 \$1;
#X msg 361 327 1;
#X msg 365 423 seed \$1;
#X obj 80 3 inlet;
#X obj 69 507 outlet;
#X obj 369 286 inlet;
#X connect 0 0 13 0;
#X connect 1 0 27 0;
#X connect 1 1 21 0;
#X connect 2 0 7 0;
#X connect 3 0 12 0;
#X connect 4 0 2 0;
#X connect 4 1 2 1;
#X connect 5 0 9 0;
#X connect 6 0 10 0;
#X connect 7 0 1 0;
#X connect 7 0 11 0;
#X connect 8 0 1 0;
#X connect 9 0 4 0;
#X connect 10 0 2 0;
#X connect 12 0 1 0;
#X connect 12 1 5 0;
#X connect 13 0 12 0;
#X connect 13 1 6 0;
#X connect 14 0 16 0;
#X connect 14 0 17 0;
#X connect 15 0 13 0;
#X connect 16 0 13 0;
#X connect 17 0 12 0;
#X connect 18 0 23 0;
#X connect 19 0 25 0;
#X connect 20 0 14 0;
#X connect 21 0 24 0;
#X connect 23 0 1 0;
#X connect 24 0 18 0;
#X connect 25 0 1 0;
#X connect 26 0 15 0;
#X connect 28 0 1 0;
#X restore 192 165 pd shader;
#X obj 192 394 pix_image ../data/fractal.JPG;
#X obj 192 199 gemframebuffer;
#X msg 219 374 open fractal.JPG;
#X floatatom 295 570 5 0 0 0 - - -;
#N canvas 800 150 640 693 shader 0;
#X msg 29 80 print;
#X obj 74 442 glsl_program;
#X obj 147 311 pack 0 0;
#X msg 31 192 print;
#X obj 168 291 t b f;
#X obj 168 246 change;
#X obj 146 121 change;
#X msg 147 351 link \$1 \$2;
#X msg 98 413 print;
#X floatatom 168 272 2 0 0 0 ID - -;
#X floatatom 146 144 2 0 0 0 ID - -;
#X obj 165 372 print linking;
#X obj 74 226 glsl_fragment;
#X obj 74 102 glsl_vertex;
#X obj 124 59 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X obj 74 24 alpha;
#X msg 88 80 open shader1.vert;
#X msg 85 196 open shader1.frag;
#X floatatom 361 352 5 0 0 0 - - -;
#X floatatom 365 401 5 0 0 0 - - -;
#N canvas 0 22 450 300 load_shader 0;
#X obj 89 99 t b b;
#X msg 119 126 0;
#X obj 89 154 outlet;
#X obj 89 71 gemhead 1;
#X connect 0 0 2 0;
#X connect 0 1 1 0;
#X connect 1 0 3 0;
#X connect 3 0 0 0;
#X restore 124 38 pd load_shader;
#N canvas 0 22 450 300 init_shader 0;
#X obj 89 154 outlet;
#X obj 89 45 inlet;
#X obj 89 73 change;
#X obj 89 100 t b;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 3 0 0 0;
#X restore 153 466 pd init_shader;
#X text 416 351 <- 2;
#X msg 361 373 K1 \$1;
#X msg 361 327 1;
#X msg 365 423 seed \$1;
#X obj 80 3 inlet;
#X obj 69 507 outlet;
#X obj 318 213 inlet;
#X connect 0 0 13 0;
#X connect 1 0 27 0;
#X connect 1 1 21 0;
#X connect 2 0 7 0;
#X connect 3 0 12 0;
#X connect 4 0 2 0;
#X connect 4 1 2 1;
#X connect 5 0 9 0;
#X connect 6 0 10 0;
#X connect 7 0 1 0;
#X connect 7 0 11 0;
#X connect 8 0 1 0;
#X connect 9 0 4 0;
#X connect 10 0 2 0;
#X connect 12 0 1 0;
#X connect 12 1 5 0;
#X connect 13 0 12 0;
#X connect 13 1 6 0;
#X connect 14 0 16 0;
#X connect 14 0 17 0;
#X connect 15 0 13 0;
#X connect 16 0 13 0;
#X connect 17 0 12 0;
#X connect 18 0 23 0;
#X connect 19 0 25 0;
#X connect 20 0 14 0;
#X connect 21 0 24 0;
#X connect 23 0 1 0;
#X connect 24 0 18 0;
#X connect 25 0 1 0;
#X connect 26 0 15 0;
#X connect 28 0 1 0;
#X restore 480 201 pd shader;
#X msg 128 384 mode \$1;
#X obj 128 357 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X text 28 354 added this!;
#X floatatom -21 427 5 0 0 0 - - -;
#X msg -21 448 K1 \$1;
#X floatatom 85 432 5 0 0 0 - - -;
#X msg 85 453 K1 \$1;
#X connect 0 0 40 0;
#X connect 1 0 56 0;
#X connect 2 0 38 2;
#X connect 3 0 38 1;
#X connect 4 0 38 3;
#X connect 5 0 53 0;
#X connect 6 0 53 0;
#X connect 7 0 31 2;
#X connect 8 0 31 3;
#X connect 9 0 31 1;
#X connect 10 0 11 0;
#X connect 12 0 53 0;
#X connect 14 0 13 0;
#X connect 15 0 36 1;
#X connect 16 0 36 3;
#X connect 17 0 53 0;
#X connect 18 0 53 0;
#X connect 19 0 53 0;
#X connect 20 0 50 0;
#X connect 21 0 20 1;
#X connect 22 0 20 2;
#X connect 23 0 20 3;
#X connect 24 0 13 0;
#X connect 25 0 13 0;
#X connect 26 0 37 1;
#X connect 27 0 52 0;
#X connect 28 0 31 0;
#X connect 29 0 53 0;
#X connect 30 0 29 0;
#X connect 31 0 20 0;
#X connect 33 0 53 0;
#X connect 34 0 1 0;
#X connect 35 0 39 3;
#X connect 36 0 38 0;
#X connect 38 0 37 0;
#X connect 39 0 27 0;
#X connect 40 0 51 0;
#X connect 41 0 13 0;
#X connect 43 0 44 0;
#X connect 44 0 36 0;
#X connect 44 1 46 0;
#X connect 45 0 47 0;
#X connect 46 0 45 0;
#X connect 46 0 48 0;
#X connect 47 0 46 1;
#X connect 48 0 16 0;
#X connect 51 0 53 0;
#X connect 52 0 28 0;
#X connect 53 0 39 0;
#X connect 53 1 43 1;
#X connect 54 0 52 0;
#X connect 55 0 50 1;
#X connect 56 0 43 0;
#X connect 57 0 28 0;
#X connect 58 0 57 0;
#X connect 60 0 61 0;
#X connect 61 0 51 1;
#X connect 62 0 63 0;
#X connect 63 0 56 1;
_______________________________________________
PD-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to