11_ev_example_opengl_shaders.pd 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #N canvas 434 22 794 756 10;
  2. #X declare -path . -path .. -path data -path ../data -path ev-in -path
  3. ../ev-in -path ev-main -path ../ev-main -path ev-pano -path ../ev-pano
  4. -path ev-pro -path ../ev-pro -path libs/gil -path ../libs/gil -path
  5. libs/kollabs -path ../libs/kollabs -path media -path ../media -path
  6. ev-glsl -path ../ev-glsl -lib Gem;
  7. #X obj 6 164 cnv 15 380 750 empty empty Two-pass_Gaussian_Blur 20 12
  8. 0 14 -262130 -66577 0;
  9. #X obj 36 236 cnv 15 340 340 empty empty Horizontal_blur 20 12 0 14
  10. -261682 -66577 0;
  11. #X obj 13 586 cnv 15 340 320 empty empty Vertical_blur 20 12 0 14 -261682
  12. -66577 0;
  13. #X obj 6 26 cnv 15 700 16 empty empty exmple:_OpenGL_Shaders 2 8 0
  14. 14 -99865 -262144 0;
  15. #X text 403 871 (c)2012 Marian Weger \; part of EXTENDEDVIEW toolkit/
  16. gpl v3;
  17. #X obj 396 353 cnv 15 310 330 empty empty controls_for_shader 20 12
  18. 0 14 -204800 -66577 0;
  19. #X obj 95 352 loadbang;
  20. #X obj 73 353 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
  21. -1;
  22. #X obj 45 416 pix_image;
  23. #X text 427 490 These controls are only for the;
  24. #X text 429 536 Other shaders might need;
  25. #X text 429 549 different controls.;
  26. #X obj 6 52 cnv 15 700 100 empty empty description 5 12 0 12 -261234
  27. -66577 0;
  28. #X obj 396 224 cnv 15 310 120 empty empty Create_Gem_Window 20 12 0
  29. 14 -204786 -66577 0;
  30. #X obj 417 319 gemwin 20;
  31. #X msg 453 295 0 \, destroy;
  32. #X msg 417 269 dimen 800 600 \, color 0.5 0.5 0.5 \, create \, 1;
  33. #X text 460 251 CLICK HERE TO START:;
  34. #X obj 476 194 ../ev-main/ev_declare;
  35. #X obj 18 211 t a a;
  36. #X obj 413 381 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
  37. -1 -1 7200 1;
  38. #X text 427 503 "gaussian_blur" shader \, loaded;
  39. #X text 429 516 in this example.;
  40. #X obj 410 650 t a;
  41. #X obj 396 700 cnv 15 310 160 empty empty Resulting_Image 20 12 0 14
  42. -232576 -66577 0;
  43. #X text 437 169 set pathes to the needed abstractions;
  44. #X text 9 79 This example shows \, how OpenGL Shaders are implemented
  45. with Extended View Toolkit.;
  46. #X text 436 72 See [ev_glsl-help] for more information (./ev-glsl/ev_glsl-help.pd).
  47. ;
  48. #X msg 73 380 open media/cam2.jpg;
  49. #X text 57 489 apply the "gaussian_blur_horizontal" shader \, that
  50. is specified by 1st creation argument.;
  51. #X text 31 820 apply the "gaussian_blur_vertical" shader \, that is
  52. specified by 1st creation argument.;
  53. #X obj 497 776 r /ev/buf/vertical/texture_id;
  54. #X text 118 215 should use the same settings.;
  55. #X text 9 109 Here \, the implementation of a 2-pass gaussian blur
  56. is shown. It consists of two indidual shaders \, that are computed
  57. one after another.;
  58. #X text 153 695 The result of buffer 1 (horizontal) \; is used in buffer
  59. 2 (vertical);
  60. #X text 487 727 The result of buffer 2 (vertical) \; containing the
  61. final blurred image \; is rendered onto a rectangle.;
  62. #X text 430 432 both \, "gaussian_blur_horizontal" and "gaussian_blur_vertical"
  63. \; use the same control variable "blur_size".;
  64. #X text 123 408 load image;
  65. #X obj 416 741 gemhead 49;
  66. #X obj 18 189 gemhead 48;
  67. #X text 118 201 both [ev_buf] ("horizontal" and "vertical");
  68. #X text 402 906 Source of fragment shader: http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
  69. ;
  70. #X obj 416 809 ev_rectangle result;
  71. #X obj 45 530 rectangle 4 3;
  72. #X msg 410 405 blur \$1;
  73. #X obj 45 264 ev_buf horizontal;
  74. #X obj 18 859 square 4;
  75. #X obj 45 447 ev_glsl horizontal dummy gaussian_blur.h;
  76. #X obj 18 610 ev_buf vertical;
  77. #X obj 18 776 ev_glsl vertical dummy gaussian_blur.v;
  78. #X obj 130 746 r /ev/buf/horizontal/texture_id;
  79. #X connect 6 0 28 0;
  80. #X connect 7 0 28 0;
  81. #X connect 8 0 47 0;
  82. #X connect 15 0 14 0;
  83. #X connect 16 0 14 0;
  84. #X connect 19 0 48 0;
  85. #X connect 19 1 45 0;
  86. #X connect 20 0 44 0;
  87. #X connect 23 0 49 2;
  88. #X connect 28 0 8 0;
  89. #X connect 31 0 42 1;
  90. #X connect 38 0 42 0;
  91. #X connect 39 0 19 0;
  92. #X connect 44 0 23 0;
  93. #X connect 44 0 47 2;
  94. #X connect 45 0 8 0;
  95. #X connect 47 0 43 0;
  96. #X connect 48 0 49 0;
  97. #X connect 49 0 46 0;
  98. #X connect 50 0 49 1;
  99. #X coords 0 756 1 755 85 60 0;