-
Notifications
You must be signed in to change notification settings - Fork 2
/
web3d_projects_20230212.html
2023 lines (1922 loc) · 242 KB
/
web3d_projects_20230212.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html><html lang="en-US"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0"><meta name="apple-mobile-web-app-capable" content="yes"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta property="og:type" content="website"><meta name="twitter:card" content="summary"><style>@media screen{body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button{-webkit-tap-highlight-color:transparent;-webkit-appearance:none;appearance:none;background-color:initial;border:0;color:inherit;cursor:pointer;font-size:inherit;opacity:.8;outline:none;padding:0;transition:opacity .2s linear}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button:disabled,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button:disabled,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button:disabled,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button:disabled{cursor:not-allowed;opacity:.15!important}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button:hover,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button:hover,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button:hover,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button:hover{opacity:1}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button:hover:active,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button:hover:active,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button:hover:active,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button:hover:active{opacity:.6}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button:hover:not(:disabled),body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button:hover:not(:disabled),body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button:hover:not(:disabled),body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button:hover:not(:disabled){transition:none}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=prev],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=prev],body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button.bespoke-marp-presenter-info-page-prev{background:#0000 url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSI1IiBkPSJNNjggOTAgMjggNTBsNDAtNDAiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=next],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=next],body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button.bespoke-marp-presenter-info-page-next{background:#0000 url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSI1IiBkPSJtMzIgOTAgNDAtNDAtNDAtNDAiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=fullscreen],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=fullscreen]{background:#0000 url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48ZGVmcz48c3R5bGU+LmF7ZmlsbDpub25lO3N0cm9rZTojZmZmO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6NXB4fTwvc3R5bGU+PC9kZWZzPjxyZWN0IGNsYXNzPSJhIiB4PSIxMCIgeT0iMjAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI2MCIgcng9IjUuNjciLz48cGF0aCBjbGFzcz0iYSIgZD0iTTQwIDcwSDIwVjUwbTIwIDBMMjAgNzBtNDAtNDBoMjB2MjBtLTIwIDAgMjAtMjAiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button.exit[data-bespoke-marp-osc=fullscreen],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button.exit[data-bespoke-marp-osc=fullscreen]{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48ZGVmcz48c3R5bGU+LmF7ZmlsbDpub25lO3N0cm9rZTojZmZmO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6NXB4fTwvc3R5bGU+PC9kZWZzPjxyZWN0IGNsYXNzPSJhIiB4PSIxMCIgeT0iMjAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI2MCIgcng9IjUuNjciLz48cGF0aCBjbGFzcz0iYSIgZD0iTTIwIDUwaDIwdjIwbS0yMCAwIDIwLTIwbTQwIDBINjBWMzBtMjAgMEw2MCA1MCIvPjwvc3ZnPg==")}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=presenter],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=presenter]{background:#0000 url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNODcuOCA0Ny41Qzg5IDUwIDg3LjcgNTIgODUgNTJIMzVhOC43IDguNyAwIDAgMS03LjItNC41bC0xNS42LTMxQzExIDE0IDEyLjIgMTIgMTUgMTJoNTBhOC44IDguOCAwIDAgMSA3LjIgNC41ek02MCA1MnYzNm0tMTAgMGgyME00NSA0MmgyMCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iNSIvPjwvc3ZnPg==") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button.bespoke-marp-presenter-note-bigger{background:#0000 url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNMTIgNTBoODBNNTIgOTBWMTAiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjUiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button.bespoke-marp-presenter-note-smaller{background:#0000 url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48cGF0aCBkPSJNMTIgNTBoODAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjUiLz48L3N2Zz4=") no-repeat 50%;background-size:contain;overflow:hidden;text-indent:100%;white-space:nowrap}}@keyframes __bespoke_marp_transition_reduced_outgoing__{0%{opacity:1}to{opacity:0}}@keyframes __bespoke_marp_transition_reduced_incoming__{0%{mix-blend-mode:plus-lighter;opacity:0}to{mix-blend-mode:plus-lighter;opacity:1}}.bespoke-marp-note,.bespoke-marp-osc,.bespoke-progress-parent{display:none;transition:none}@media screen{::view-transition-group(*){animation-duration:var(--marp-bespoke-transition-animation-duration,.5s);animation-timing-function:ease}::view-transition-new(*),::view-transition-old(*){animation-delay:0s;animation-direction:var(--marp-bespoke-transition-animation-direction,normal);animation-duration:var(--marp-bespoke-transition-animation-duration,.5s);animation-fill-mode:both;animation-name:var(--marp-bespoke-transition-animation-name,var(--marp-bespoke-transition-animation-name-fallback,__bespoke_marp_transition_no_animation__));mix-blend-mode:normal}::view-transition-old(*){--marp-bespoke-transition-animation-name-fallback:__bespoke_marp_transition_reduced_outgoing__;animation-timing-function:ease}::view-transition-new(*){--marp-bespoke-transition-animation-name-fallback:__bespoke_marp_transition_reduced_incoming__;animation-timing-function:ease}::view-transition-new(root),::view-transition-old(root){animation-timing-function:linear}::view-transition-new(__bespoke_marp_transition_osc__),::view-transition-old(__bespoke_marp_transition_osc__){animation-duration:0s!important;animation-name:__bespoke_marp_transition_osc__!important}::view-transition-new(__bespoke_marp_transition_osc__){opacity:0!important}.bespoke-marp-transition-warming-up::view-transition-group(*),.bespoke-marp-transition-warming-up::view-transition-new(*),.bespoke-marp-transition-warming-up::view-transition-old(*){animation-play-state:paused!important}body,html{height:100%;margin:0}body{background:#000;overflow:hidden}svg.bespoke-marp-slide{content-visibility:hidden;opacity:0;pointer-events:none;z-index:-1}svg.bespoke-marp-slide:not(.bespoke-marp-active) *{view-transition-name:none!important}svg.bespoke-marp-slide.bespoke-marp-active{content-visibility:visible;opacity:1;pointer-events:auto;z-index:0}svg.bespoke-marp-slide.bespoke-marp-active.bespoke-marp-active-ready *{animation-name:__bespoke_marp__!important}@supports not (content-visibility:hidden){svg.bespoke-marp-slide[data-bespoke-marp-load=hideable]{display:none}svg.bespoke-marp-slide[data-bespoke-marp-load=hideable].bespoke-marp-active{display:block}}}@media screen and (prefers-reduced-motion:reduce){svg.bespoke-marp-slide *{view-transition-name:none!important}}@media screen{[data-bespoke-marp-fragment=inactive]{visibility:hidden}body[data-bespoke-view=""] .bespoke-marp-parent,body[data-bespoke-view=next] .bespoke-marp-parent{bottom:0;left:0;position:absolute;right:0;top:0}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc{view-transition-name:__bespoke_marp_transition_osc__;background:#000000a6;border-radius:7px;bottom:50px;color:#fff;contain:paint;display:block;font-family:Helvetica,Arial,sans-serif;font-size:16px;left:50%;line-height:0;opacity:1;padding:12px;position:absolute;touch-action:manipulation;transform:translateX(-50%);transition:opacity .2s linear;-webkit-user-select:none;user-select:none;white-space:nowrap;will-change:transform;z-index:1}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>*,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>*{margin-left:6px}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>:first-child,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>:first-child{margin-left:0}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>span,body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>span{opacity:.8}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>span[data-bespoke-marp-osc=page],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>span[data-bespoke-marp-osc=page]{display:inline-block;min-width:140px;text-align:center}body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=fullscreen],body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=next],body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=presenter],body[data-bespoke-view=""] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=prev],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=fullscreen],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=next],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=presenter],body[data-bespoke-view=next] .bespoke-marp-parent>.bespoke-marp-osc>button[data-bespoke-marp-osc=prev]{height:32px;line-height:32px;width:32px}body[data-bespoke-view=""] .bespoke-marp-parent.bespoke-marp-inactive,body[data-bespoke-view=next] .bespoke-marp-parent.bespoke-marp-inactive{cursor:none}body[data-bespoke-view=""] .bespoke-marp-parent.bespoke-marp-inactive>.bespoke-marp-osc,body[data-bespoke-view=next] .bespoke-marp-parent.bespoke-marp-inactive>.bespoke-marp-osc{opacity:0;pointer-events:none}body[data-bespoke-view=""] svg.bespoke-marp-slide,body[data-bespoke-view=next] svg.bespoke-marp-slide{height:100%;left:0;position:absolute;top:0;width:100%}body[data-bespoke-view=""] .bespoke-progress-parent{background:#222;display:flex;height:5px;width:100%}body[data-bespoke-view=""] .bespoke-progress-parent+.bespoke-marp-parent{top:5px}body[data-bespoke-view=""] .bespoke-progress-parent .bespoke-progress-bar{background:#0288d1;flex:0 0 0;transition:flex-basis .2s cubic-bezier(0,1,1,1)}body[data-bespoke-view=next]{background:#0000}body[data-bespoke-view=presenter]{background:#161616}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container{display:grid;font-family:Helvetica,Arial,sans-serif;grid-template:"current dragbar next" minmax(140px,1fr) "current dragbar note" 2fr "info dragbar note" 3em;grid-template-columns:minmax(3px,var(--bespoke-marp-presenter-split-ratio,66%)) 0 minmax(3px,1fr);height:100%;left:0;position:absolute;top:0;width:100%}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-parent{grid-area:current;overflow:hidden;position:relative}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-parent svg.bespoke-marp-slide{height:calc(100% - 40px);left:20px;pointer-events:none;position:absolute;top:20px;-webkit-user-select:none;user-select:none;width:calc(100% - 40px)}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-parent svg.bespoke-marp-slide.bespoke-marp-active{filter:drop-shadow(0 3px 10px rgba(0,0,0,.5))}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-dragbar-container{background:#0288d1;cursor:col-resize;grid-area:dragbar;margin-left:-3px;opacity:0;position:relative;transition:opacity .4s linear .1s;width:6px;z-index:10}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-dragbar-container:hover{opacity:1}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-dragbar-container.active{opacity:1;transition-delay:0s}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-next-container{background:#222;cursor:pointer;display:none;grid-area:next;overflow:hidden;position:relative}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-next-container.active{display:block}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-next-container iframe.bespoke-marp-presenter-next{background:#0000;border:0;display:block;filter:drop-shadow(0 3px 10px rgba(0,0,0,.5));height:calc(100% - 40px);left:20px;pointer-events:none;position:absolute;top:20px;-webkit-user-select:none;user-select:none;width:calc(100% - 40px)}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container{background:#222;color:#eee;grid-area:note;position:relative;z-index:1}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container button{height:1.5em;line-height:1.5em;width:1.5em}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-presenter-note-wrapper{bottom:0;display:block;left:0;position:absolute;right:0;top:0}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-presenter-note-buttons{background:#000000a6;border-radius:4px;bottom:0;display:flex;gap:4px;margin:12px;opacity:0;padding:6px;pointer-events:none;position:absolute;right:0;transition:opacity .2s linear}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-presenter-note-buttons:focus-within,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-presenter-note-wrapper:focus-within+.bespoke-marp-presenter-note-buttons,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container:hover .bespoke-marp-presenter-note-buttons{opacity:1;pointer-events:auto}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note{word-wrap:break-word;box-sizing:border-box;font-size:calc(1.1em*var(--bespoke-marp-note-font-scale, 1));height:calc(100% - 40px);margin:20px;overflow:auto;padding-right:3px;scrollbar-color:#eeeeee80 #0000;scrollbar-width:thin;white-space:pre-wrap;width:calc(100% - 40px)}}@media screen{body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note::-webkit-scrollbar{width:6px}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note::-webkit-scrollbar-track{background:#0000}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note::-webkit-scrollbar-thumb{background:#eeeeee80;border-radius:6px}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note:empty{pointer-events:none}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note.active{display:block}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note p:first-child{margin-top:0}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-note-container .bespoke-marp-note p:last-child{margin-bottom:0}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container{align-items:center;box-sizing:border-box;color:#eee;display:flex;flex-wrap:nowrap;grid-area:info;justify-content:center;overflow:hidden;padding:0 10px}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-page,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-time,body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-timer{box-sizing:border-box;display:block;padding:0 10px;white-space:nowrap;width:100%}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container button{height:1.5em;line-height:1.5em;width:1.5em}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-page{order:2;text-align:center}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-page .bespoke-marp-presenter-info-page-text{display:inline-block;min-width:120px;text-align:center}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-time{color:#999;order:1;text-align:left}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-timer{color:#999;order:3;text-align:right}body[data-bespoke-view=presenter] .bespoke-marp-presenter-container .bespoke-marp-presenter-info-container .bespoke-marp-presenter-info-timer:hover{cursor:pointer}}@media print{.bespoke-marp-presenter-info-container,.bespoke-marp-presenter-next-container,.bespoke-marp-presenter-note-container{display:none}}</style><style>@charset "UTF-8";@import "https://fonts.bunny.net/css?family=Lato:400,900|Roboto+Mono:400,700&display=swap";div#p>svg>foreignObject>section{width:1280px;height:720px;box-sizing:border-box;overflow:hidden;position:relative;scroll-snap-align:center center}div#p>svg>foreignObject>section:after{bottom:0;content:attr(data-marpit-pagination);padding:inherit;pointer-events:none;position:absolute;right:0}div#p>svg>foreignObject>section:not([data-marpit-pagination]):after{display:none}/* Normalization */div#p>svg>foreignObject>section :is(h1,marp-h1){font-size:2em;margin:0.67em 0}div#p>svg>foreignObject>section video::-webkit-media-controls{will-change:transform}@page{size:1280px 720px;margin:0}@media print{body,html{background-color:#fff;margin:0;page-break-inside:avoid;break-inside:avoid-page}div#p>svg>foreignObject>section{page-break-before:always;break-before:page}div#p>svg>foreignObject>section,div#p>svg>foreignObject>section *{-webkit-print-color-adjust:exact!important;animation-delay:0s!important;animation-duration:0s!important;color-adjust:exact!important;transition:none!important}div#p>svg[data-marpit-svg]{display:block;height:100vh;width:100vw}}div#p>svg>foreignObject>section img[data-marp-twemoji]{background:transparent;height:1em;margin:0 .05em 0 .1em;vertical-align:-.1em;width:1em}
/*!
* Marp / Marpit Gaia theme.
*
* @theme gaia
* @author Yuki Hattori
*
* @auto-scaling true
* @size 16:9 1280px 720px
* @size 4:3 960px 720px
*/div#p>svg>foreignObject>section :is(pre,marp-pre) code.hljs{display:block;overflow-x:auto;padding:1em}div#p>svg>foreignObject>section code.hljs{padding:3px 5px}div#p>svg>foreignObject>section .hljs{background:#000;color:#f8f8f8}div#p>svg>foreignObject>section .hljs-comment,div#p>svg>foreignObject>section .hljs-quote{color:#aeaeae;font-style:italic}div#p>svg>foreignObject>section .hljs-keyword,div#p>svg>foreignObject>section .hljs-selector-tag,div#p>svg>foreignObject>section .hljs-type{color:#e28964}div#p>svg>foreignObject>section .hljs-string{color:#65b042}div#p>svg>foreignObject>section .hljs-subst{color:#daefa3}div#p>svg>foreignObject>section .hljs-link,div#p>svg>foreignObject>section .hljs-regexp{color:#e9c062}div#p>svg>foreignObject>section .hljs-name,div#p>svg>foreignObject>section .hljs-section,div#p>svg>foreignObject>section .hljs-tag,div#p>svg>foreignObject>section .hljs-title{color:#89bdff}div#p>svg>foreignObject>section .hljs-class .hljs-title,div#p>svg>foreignObject>section .hljs-doctag,div#p>svg>foreignObject>section .hljs-title.class_{text-decoration:underline}div#p>svg>foreignObject>section .hljs-bullet,div#p>svg>foreignObject>section .hljs-number,div#p>svg>foreignObject>section .hljs-symbol{color:#3387cc}div#p>svg>foreignObject>section .hljs-params,div#p>svg>foreignObject>section .hljs-template-variable,div#p>svg>foreignObject>section .hljs-variable{color:#3e87e3}div#p>svg>foreignObject>section .hljs-attribute{color:#cda869}div#p>svg>foreignObject>section .hljs-meta{color:#8996a8}div#p>svg>foreignObject>section .hljs-formula{background-color:#0e2231;color:#f8f8f8;font-style:italic}div#p>svg>foreignObject>section .hljs-addition{background-color:#253b22;color:#f8f8f8}div#p>svg>foreignObject>section .hljs-deletion{background-color:#420e09;color:#f8f8f8}div#p>svg>foreignObject>section .hljs-selector-class{color:#9b703f}div#p>svg>foreignObject>section .hljs-selector-id{color:#8b98ab}div#p>svg>foreignObject>section .hljs-emphasis{font-style:italic}div#p>svg>foreignObject>section .hljs-strong{font-weight:700}div#p>svg>foreignObject>section :is(h1,marp-h1),div#p>svg>foreignObject>section :is(h2,marp-h2),div#p>svg>foreignObject>section :is(h3,marp-h3),div#p>svg>foreignObject>section :is(h4,marp-h4),div#p>svg>foreignObject>section :is(h5,marp-h5),div#p>svg>foreignObject>section :is(h6,marp-h6){margin:.5em 0 0}div#p>svg>foreignObject>section :is(h1,marp-h1) strong,div#p>svg>foreignObject>section :is(h2,marp-h2) strong,div#p>svg>foreignObject>section :is(h3,marp-h3) strong,div#p>svg>foreignObject>section :is(h4,marp-h4) strong,div#p>svg>foreignObject>section :is(h5,marp-h5) strong,div#p>svg>foreignObject>section :is(h6,marp-h6) strong{font-weight:inherit}div#p>svg>foreignObject>section :is(h1,marp-h1)::part(auto-scaling),div#p>svg>foreignObject>section :is(h2,marp-h2)::part(auto-scaling),div#p>svg>foreignObject>section :is(h3,marp-h3)::part(auto-scaling),div#p>svg>foreignObject>section :is(h4,marp-h4)::part(auto-scaling),div#p>svg>foreignObject>section :is(h5,marp-h5)::part(auto-scaling),div#p>svg>foreignObject>section :is(h6,marp-h6)::part(auto-scaling){max-height:580px}div#p>svg>foreignObject>section :is(h1,marp-h1){font-size:1.8em}div#p>svg>foreignObject>section :is(h2,marp-h2){font-size:1.5em}div#p>svg>foreignObject>section :is(h3,marp-h3){font-size:1.3em}div#p>svg>foreignObject>section :is(h4,marp-h4){font-size:1.1em}div#p>svg>foreignObject>section :is(h5,marp-h5){font-size:1em}div#p>svg>foreignObject>section :is(h6,marp-h6){font-size:.9em}div#p>svg>foreignObject>section blockquote,div#p>svg>foreignObject>section p{margin:1em 0 0}div#p>svg>foreignObject>section ol>li,div#p>svg>foreignObject>section ul>li{margin:.3em 0 0}div#p>svg>foreignObject>section ol>li>p,div#p>svg>foreignObject>section ul>li>p{margin:.6em 0 0}div#p>svg>foreignObject>section code{display:inline-block;font-family:Roboto Mono,monospace;font-size:.8em;letter-spacing:0;margin:-.1em .15em;padding:.1em .2em;vertical-align:baseline}div#p>svg>foreignObject>section :is(pre,marp-pre){display:block;margin:1em 0 0;overflow:visible}div#p>svg>foreignObject>section :is(pre,marp-pre) code{box-sizing:border-box;font-size:.7em;margin:0;min-width:100%;padding:.5em}div#p>svg>foreignObject>section :is(pre,marp-pre)::part(auto-scaling){max-height:calc(580px - 1em)}div#p>svg>foreignObject>section blockquote{margin:1em 0 0;padding:0 1em;position:relative}div#p>svg>foreignObject>section blockquote:after,div#p>svg>foreignObject>section blockquote:before{content:"“";display:block;font-family:Times New Roman,serif;font-weight:700;position:absolute}div#p>svg>foreignObject>section blockquote:before{left:0;top:0}div#p>svg>foreignObject>section blockquote:after{bottom:0;right:0;transform:rotate(180deg)}div#p>svg>foreignObject>section blockquote>:first-child{margin-top:0}div#p>svg>foreignObject>section mark{background:transparent}div#p>svg>foreignObject>section table{border-collapse:collapse;border-spacing:0;margin:1em 0 0}div#p>svg>foreignObject>section table td,div#p>svg>foreignObject>section table th{border-style:solid;border-width:1px;padding:.2em .4em}div#p>svg>foreignObject>section footer,div#p>svg>foreignObject>section header,div#p>svg>foreignObject>section:after{box-sizing:border-box;font-size:66%;height:70px;line-height:50px;overflow:hidden;padding:10px 25px;position:absolute}div#p>svg>foreignObject>section:after{--marpit-root-font-size:66%}div#p>svg>foreignObject>section header{top:0}div#p>svg>foreignObject>section footer,div#p>svg>foreignObject>section header{left:0;right:0}div#p>svg>foreignObject>section footer{bottom:0}div#p>svg>foreignObject>section{word-wrap:break-word;--color-background:#fff8e1;--color-background-stripe:rgba(69,90,100,.1);--color-foreground:#455a64;--color-dimmed:#6a7a7d;--color-highlight:#0288d1;background-color:var(--color-background);background-image:linear-gradient(135deg,hsla(0,0%,53%,0),hsla(0,0%,53%,.02) 50%,hsla(0,0%,100%,0) 0,hsla(0,0%,100%,.05));color:var(--color-foreground);font-family:Lato,Avenir Next,Avenir,Trebuchet MS,Segoe UI,sans-serif;font-size:35px;height:720px;letter-spacing:1.25px;line-height:1.35;padding:70px;width:1280px}div#p>svg>foreignObject>section{--marpit-root-font-size:35px}div#p>svg>foreignObject>section:after{bottom:0;font-size:80%;right:0}div#p>svg>foreignObject>section:after{--marpit-root-font-size:80%}div#p>svg>foreignObject>section a,div#p>svg>foreignObject>section mark{color:var(--color-highlight)}div#p>svg>foreignObject>section code{background:var(--color-dimmed);color:var(--color-background)}div#p>svg>foreignObject>section :is(h1,marp-h1) strong,div#p>svg>foreignObject>section :is(h2,marp-h2) strong,div#p>svg>foreignObject>section :is(h3,marp-h3) strong,div#p>svg>foreignObject>section :is(h4,marp-h4) strong,div#p>svg>foreignObject>section :is(h5,marp-h5) strong,div#p>svg>foreignObject>section :is(h6,marp-h6) strong{color:var(--color-highlight)}div#p>svg>foreignObject>section :is(pre,marp-pre){background:var(--color-foreground)}div#p>svg>foreignObject>section :is(pre,marp-pre)>code{background:transparent}div#p>svg>foreignObject>section blockquote:after,div#p>svg>foreignObject>section blockquote:before,div#p>svg>foreignObject>section footer,div#p>svg>foreignObject>section header,div#p>svg>foreignObject>section section:after{color:var(--color-dimmed)}div#p>svg>foreignObject>section table td,div#p>svg>foreignObject>section table th{border-color:var(--color-foreground)}div#p>svg>foreignObject>section table thead th{background:var(--color-foreground);color:var(--color-background)}div#p>svg>foreignObject>section table tbody>tr:nth-child(odd) td,div#p>svg>foreignObject>section table tbody>tr:nth-child(odd) th{background:var(--color-background-stripe,transparent)}div#p>svg>foreignObject>section>:first-child,div#p>svg>foreignObject>section>header:first-child+*{margin-top:0}div#p>svg>foreignObject>section:where(.invert){--color-background:#455a64;--color-background-stripe:rgba(255,248,225,.1);--color-foreground:#fff8e1;--color-dimmed:#dad8c8;--color-highlight:#81d4fa}div#p>svg>foreignObject>section:where(.gaia){--color-background:#0288d1;--color-background-stripe:rgba(255,248,225,.1);--color-foreground:#fff8e1;--color-dimmed:#cce2de;--color-highlight:#81d4fa}div#p>svg>foreignObject>section:where(.lead){display:flex;flex-flow:column nowrap;justify-content:center}div#p>svg>foreignObject>section:where(.lead) :is(h1,marp-h1),div#p>svg>foreignObject>section:where(.lead) :is(h2,marp-h2),div#p>svg>foreignObject>section:where(.lead) :is(h3,marp-h3),div#p>svg>foreignObject>section:where(.lead) :is(h4,marp-h4),div#p>svg>foreignObject>section:where(.lead) :is(h5,marp-h5),div#p>svg>foreignObject>section:where(.lead) :is(h6,marp-h6){text-align:center}div#p>svg>foreignObject>section:where(.lead) p{text-align:center}div#p>svg>foreignObject>section:where(.lead) blockquote>:is(h1,marp-h1),div#p>svg>foreignObject>section:where(.lead) blockquote>:is(h2,marp-h2),div#p>svg>foreignObject>section:where(.lead) blockquote>:is(h3,marp-h3),div#p>svg>foreignObject>section:where(.lead) blockquote>:is(h4,marp-h4),div#p>svg>foreignObject>section:where(.lead) blockquote>:is(h5,marp-h5),div#p>svg>foreignObject>section:where(.lead) blockquote>:is(h6,marp-h6),div#p>svg>foreignObject>section:where(.lead) blockquote>p{text-align:left}div#p>svg>foreignObject>section:where(.lead) ol>li>p,div#p>svg>foreignObject>section:where(.lead) ul>li>p{text-align:left}div#p>svg>foreignObject>section:where(.lead) table{margin-left:auto;margin-right:auto}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#p>svg>foreignObject>section[data-marpit-advanced-background=content],div#p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}</style></head><body><div class="bespoke-marp-osc"><button data-bespoke-marp-osc="prev" tabindex="-1" title="Previous slide">Previous slide</button><span data-bespoke-marp-osc="page"></span><button data-bespoke-marp-osc="next" tabindex="-1" title="Next slide">Next slide</button><button data-bespoke-marp-osc="fullscreen" tabindex="-1" title="Toggle fullscreen (f)">Toggle fullscreen</button><button data-bespoke-marp-osc="presenter" tabindex="-1" title="Open presenter view (p)">Open presenter view</button></div><div id="p"><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-class="invert" data-theme="gaia" class="invert" style="--class:invert;--theme:gaia;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("https://ipfs.io/ipfs/Qmb8ayrfFzwyMQr4p5ru6V5bLD7v3qodxjnRWvmeAy5SD9");background-size:100%;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="1" data-class="invert" data-theme="gaia" class="invert" style="--class:invert;--theme:gaia;" data-marpit-advanced-background="content">
<h1><strong>Création d'applications 3D</strong></h1>
<h2><strong>en utilisant les technologies du Web</strong></h2>
<p>Fivos Doganis | <a href="mailto:fivos.doganis@gmail.com">fivos.doganis@gmail.com</a></p>
</section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-class="invert" data-theme="gaia" class="invert" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="2" data-footer="image de couverture: https://teia.art/objkt/627718" data-theme="gaia" style="--footer:image de couverture: https://teia.art/objkt/627718;--theme:gaia;">
<h1>Intérêt du Web pour la 3D</h1>
<ul>
<li>expériences <strong>mobiles</strong></li>
<li>technologies <strong>libres</strong>
<ul>
<li><strong>cross-platform</strong>, pas d'installation, pas de store</li>
<li>ouvertes</li>
<li><strong>non-propiétaires</strong> (contrairement à Unity ou Unreal)</li>
<li><strong>gratuites</strong></li>
</ul>
</li>
<li>interfaçage avec de nombreuses APIs web existantes</li>
</ul>
<footer>image de couverture: <a href="https://teia.art/objkt/627718">https://teia.art/objkt/627718</a></footer>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="3" data-paginate="true" data-theme="gaia" data-marpit-pagination="3" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Etapes</h1>
<ul>
<li>Run</li>
<li>Debug</li>
<li>Build</li>
<li>Modify</li>
<li>Create</li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="4" data-paginate="true" data-theme="gaia" data-marpit-pagination="4" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Run: Demo</h1>
<ul>
<li>Vérifier que votre smartphone supporte le scan de <a href="https://en.wikipedia.org/wiki/QR_code">QR code</a></li>
<li>iOS : app Camera par défault</li>
<li>Android
<ul>
<li>utiliser Google Chrome + bouton scan</li>
<li>ou installer une application fiable de scan de QR code comme <strong><a href="https://play.google.com/store/apps/details?id=com.trendmicro.qrscan">Trend Micro</a></strong></li>
</ul>
</li>
<li>Solutions 100% web
<ul>
<li>webqr.com</li>
<li>qrcodescan.in</li>
</ul>
</li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="5" data-paginate="true" data-theme="gaia" data-marpit-pagination="5" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Debug</h1>
<ul>
<li>There will be bugs :) <img class="emoji" draggable="false" alt="🐛" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f41b.svg" data-marp-twemoji=""/></li>
<li>F12</li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger"><code>debugger</code> statement</a></li>
<li>Tips:
<ul>
<li><a href="https://webglfundamentals.org/webgl/lessons/webgl-setup-and-installation.html">https://webglfundamentals.org/webgl/lessons/webgl-setup-and-installation.html</a></li>
<li><a href="https://threejs.org/manual/en/debugging-javascript.html">https://threejs.org/manual/en/debugging-javascript.html</a></li>
<li><a href="https://www.khronos.org/webgl/wiki/Debugging">https://www.khronos.org/webgl/wiki/Debugging</a></li>
</ul>
</li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="6" data-paginate="true" data-theme="gaia" data-marpit-pagination="6" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Build: outils</h1>
<ul>
<li>
<p>Développement web</p>
<ul>
<li>navigateur (Firefox, Chrome, Safari Mobile)</li>
<li>Git (facultatif mais très utile)</li>
<li>éditeur (VSCode), ou <a href="https://glitch.com/">Glitch</a> (aucune installation!)</li>
</ul>
</li>
<li>
<p>Technologies: HTML, JS, CSS, WebGL, THREE.js</p>
</li>
<li>
<p>Optionnel:</p>
<ul>
<li>OpenStreetMap, OpenLayers, CesiumJS, <a href="https://geoservices.ign.fr/documentation/diffusion/telechargement-donnees-libres.html">Géoservices IGN</a></li>
</ul>
</li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="7" data-paginate="true" data-theme="gaia" data-marpit-pagination="7" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Installation du navigateur</h1>
<ul>
<li>Firefox installé par défaut
<ul>
<li>devrait suffir!</li>
</ul>
</li>
<li>Chrome
<ul>
<li>pour tester la compatibilité et certaines fonctionnalités</li>
<li>installer la dernière version (97+) sur mobile</li>
<li>installer Chromium sur desktop
<ul>
<li>version open-source sans services propriétaires</li>
</ul>
</li>
</ul>
</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-bash">sudo apt-get install chromium-browser
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="8" data-paginate="true" data-theme="gaia" data-marpit-pagination="8" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Installation de Git</h1>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code>sudo apt-get install git
git config --global user.name "myusername"
git config --global user.email myname@mymailprovider.com
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="9" data-paginate="true" data-theme="gaia" data-marpit-pagination="9" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1><a href="https://linuxize.com/post/how-to-install-visual-studio-code-on-ubuntu-18-04/">Installation de l'éditeur VSCode</a></h1>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-bash">sudo apt update
sudo apt install software-properties-common apt-transport-https wget
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
sudo add-apt-repository <span class="hljs-string">"deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"</span>
sudo apt install code
</code></pre>
<p><a href="https://unix.stackexchange.com/questions/452020/">Supprimer les warnings GPG</a></p>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code>sudo gpgconf --kill dirmngr
sudo chown -R $USER:$USER ~/.gnupg
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="10" data-paginate="true" data-theme="gaia" data-marpit-pagination="10" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Customisation</h1>
<ul>
<li>Eviter clignottement de la UI en modifiant les préférences:</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-bash"><span class="hljs-built_in">set</span> window.titleBarStyle to custom
</code></pre>
<ul>
<li>Extensions conseillées
<ul>
<li><a href="https://marketplace.visualstudio.com/items?itemName=yandeu.five-server">Five Server</a> (ici on utilisera un autre server)</li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph"><strong>Git Graph</strong></a></li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=cesium.gltf-vscode"><strong>glTF Tools</strong></a></li>
<li><a href="https://github.com/racz16/WebGL-GLSL-Editor">WebGL GLSL Editor</a>,</li>
<li><a href="https://marketplace.visualstudio.com/items?itemName=circledev.glsl-canvas">glsl-canvas</a></li>
</ul>
</li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-paginate="true" data-class="invert" data-theme="gaia" class="invert" data-marpit-pagination="11" data-marpit-pagination-total="126" style="--paginate:true;--class:invert;--theme:gaia;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("https://i.stack.imgur.com/H8fpQ.png");background-size:contain;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="11" data-paginate="true" data-class="invert" data-theme="gaia" class="invert" data-marpit-pagination="11" data-marpit-pagination-total="126" style="--paginate:true;--class:invert;--theme:gaia;" data-marpit-advanced-background="content">
<ul>
<li>File > Settings > Format on Save <img class="emoji" draggable="false" alt="⭐" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/2b50.svg" data-marp-twemoji=""/></li>
</ul>
</section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-paginate="true" data-class="invert" data-theme="gaia" class="invert" data-marpit-pagination="11" data-marpit-pagination-total="126" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="12" data-paginate="true" data-theme="gaia" data-marpit-pagination="12" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Développement en local</h1>
<ul>
<li>Impossible de charger un fichier depuis le disque sans action utilisateur</li>
<li>CORS: <a href="https://developer.mozilla.org/fr/docs/Web/HTTP/CORS">Cross Origin Resource Sharing</a>
<ul>
<li>une des nombreuses mesures de sécurité des navigateurs web</li>
</ul>
</li>
</ul>
<p><img class="emoji" draggable="false" alt="➡️" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/27a1.svg" data-marp-twemoji=""/> nécessité de lancer un serveur, comme <a href="https://marketplace.visualstudio.com/items?itemName=yandeu.five-server">Five Server</a>, ou encore:</p>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">cd</span> /home/somedir</span>
<span class="hljs-meta prompt_">$ </span><span class="language-bash">python -m SimpleHTTPServer</span>
</code></pre>
<p>Puis aller sur <code>http://localhost:8000</code></p>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="13" data-paginate="true" data-theme="gaia" data-marpit-pagination="13" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Glitch: éditeur interactif en ligne</h1>
<p><img src="https://aws1.discourse-cdn.com/business6/uploads/glitch/original/2X/6/63bf00cd3adcc2f2d9ee808d52941634f26e01bc.png" alt="" /></p>
<ul>
<li><a href="https://glitch.com/">https://glitch.com/</a></li>
<li><a href="https://glitch.com/~threejs">Exemple THREE.js</a></li>
</ul>
<p>Mais aussi Codepen.io, Repl.it etc.</p>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="14" data-paginate="true" data-class="invert lead" data-theme="gaia" class="invert lead" data-marpit-pagination="14" data-marpit-pagination-total="126" style="--paginate:true;--class:invert lead;--theme:gaia;">
<h1>Exercices WebGL</h1>
<ul>
<li>webglacademy</li>
<li>webglfundamentals</li>
<li>webgl2fundamentals</li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="15" data-paginate="true" data-theme="gaia" data-marpit-pagination="15" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Vérifier que WebGL est supporté</h1>
<ul>
<li><a href="https://caniuse.com/webgl">https://caniuse.com/webgl</a></li>
<li><a href="https://webglreport.com/">https://webglreport.com/</a></li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="16" data-paginate="true" data-theme="gaia" data-marpit-pagination="16" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<p><strong>Programme minimaliste</strong>: permet de tester que WebGL fonctionne<br />
<img class="emoji" draggable="false" alt="⚠️" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/26a0.svg" data-marp-twemoji=""/> <strong>aucun test d'erreur</strong>, pour plus de clarté (<em>don't do this at home!</em> <img class="emoji" draggable="false" alt="😉" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f609.svg" data-marp-twemoji=""/>)</p>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-html"><span class="hljs-meta"><!DOCTYPE <span class="hljs-keyword">html</span>></span>
<span class="hljs-tag"><<span class="hljs-name">html</span>></span>
<span class="hljs-tag"><<span class="hljs-name">head</span>></span>
<span class="hljs-tag"><<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">'utf-8'</span>></span>
<span class="hljs-tag"></<span class="hljs-name">head</span>></span>
<span class="hljs-tag"><<span class="hljs-name">body</span>></span>
<span class="hljs-tag"><<span class="hljs-name">canvas</span> <span class="hljs-attr">width</span>=<span class="hljs-string">'640'</span> <span class="hljs-attr">height</span>=<span class="hljs-string">'480'</span>></span>
<span class="hljs-tag"><<span class="hljs-name">script</span>></span><span class="language-javascript">
<span class="hljs-keyword">const</span> canvas = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">querySelector</span>(<span class="hljs-string">'canvas'</span>);
<span class="hljs-comment">/** <span class="hljs-doctag">@type</span> {<span class="hljs-type">WebGLRenderingContext</span>} */</span>
<span class="hljs-keyword">const</span> gl = canvas.<span class="hljs-title function_">getContext</span>(<span class="hljs-string">'webgl'</span>); <span class="hljs-comment">// instead of '2d'</span>
gl.<span class="hljs-title function_">clearColor</span>(<span class="hljs-number">1.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">1.</span>); <span class="hljs-comment">// RGBA: opaque red</span>
gl.<span class="hljs-title function_">clear</span>(gl.<span class="hljs-property">COLOR_BUFFER_BIT</span>); <span class="hljs-comment">// uses current color (state machine)</span>
</span><span class="hljs-tag"></<span class="hljs-name">script</span>></span>
<span class="hljs-tag"></<span class="hljs-name">body</span>></span>
<span class="hljs-tag"></<span class="hljs-name">html</span>></span>
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="17" data-theme="gaia" style="--theme:gaia;"><iframe style=
"position: absolute;
top: 110px;
bottom: 110px;
left: 320px;
right: 320px;
width:100%;
height: 100%;
border: 0;" srcdoc ="
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<canvas width='640' height='480'></canvas>
<script>
const canvas = document.querySelector('canvas');
const gl = canvas.getContext('webgl');
gl.clearColor(1., 0., 0., 1.);
gl.clear(gl.COLOR_BUFFER_BIT);
</script>
</body>
</html>" >
</iframe>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-paginate="true" data-theme="gaia" data-marpit-pagination="18" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("https://webglfundamentals.org/webgl/lessons/resources/webglfundamentals-webgl-state-diagram.jpg");background-size:contain;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="18" data-paginate="true" data-theme="gaia" data-marpit-pagination="18" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;" data-marpit-advanced-background="content">
<p><a href="https://webglfundamentals.org/webgl/lessons/resources/webgl-state-diagram.html?exampleId=smallest#no-help">Etats</a></p>
</section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-paginate="true" data-theme="gaia" data-marpit-pagination="18" data-marpit-pagination-total="126" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="19" data-paginate="true" data-theme="gaia" data-marpit-pagination="19" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<p><a href="https://webglfundamentals.org/webgl/lessons/webgl-smallest-programs.html"><strong>Programme minimaliste "utile"</strong></a>: des shaders, sans vertex buffer</p>
<p>Ajouter ce code à la suite de <code>gl.clear</code>:</p>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"> <span class="hljs-comment">// vertex shader</span>
<span class="hljs-keyword">const</span> vs_source = <span class="hljs-string">`
void main() {
gl_Position = vec4(0., 0., 0., 1.); // center
gl_PointSize = 120.0;
}`</span>;
<span class="hljs-comment">// fragment shader</span>
<span class="hljs-keyword">const</span> fs_source = <span class="hljs-string">`
precision mediump float;
void main() {
gl_FragColor = vec4(0., 1., 0., 1.); // green
}`</span>;
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="20" data-paginate="true" data-theme="gaia" data-marpit-pagination="20" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<p>Suite du code: <a href="https://github.com/gfxfundamentals/webgl-fundamentals/blob/master/webgl/resources/webgl-utils.js">fonctions utiles</a> (toujours sans test d'erreur!)</p>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"> <span class="hljs-keyword">function</span> <span class="hljs-title function_">buildShader</span>(<span class="hljs-params">gl, shaderSource, shaderType</span>) {
<span class="hljs-keyword">const</span> shader = gl.<span class="hljs-title function_">createShader</span>(shaderType); <span class="hljs-comment">// Create the shader object</span>
gl.<span class="hljs-title function_">shaderSource</span>(shader, shaderSource); <span class="hljs-comment">// Load the shader source</span>
gl.<span class="hljs-title function_">compileShader</span>(shader); <span class="hljs-comment">// Compile the shader</span>
<span class="hljs-keyword">return</span> shader;
}
<span class="hljs-keyword">function</span> <span class="hljs-title function_">createProgram</span>(<span class="hljs-params">gl, shaders</span>) {
<span class="hljs-keyword">const</span> program = gl.<span class="hljs-title function_">createProgram</span>();
shaders.<span class="hljs-title function_">forEach</span>(<span class="hljs-keyword">function</span>(<span class="hljs-params">shader</span>) {
gl.<span class="hljs-title function_">attachShader</span>(program, shader);
});
gl.<span class="hljs-title function_">linkProgram</span>(program);
<span class="hljs-keyword">return</span> program;
}
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="21" data-paginate="true" data-theme="gaia" data-marpit-pagination="21" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<p><strong>Suite et fin</strong> du code: chargement des shaders, du programme et rendu</p>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript">
<span class="hljs-comment">// load and compile the shaders</span>
<span class="hljs-keyword">const</span> vs = <span class="hljs-title function_">buildShader</span>(gl, vs_source, gl.<span class="hljs-property">VERTEX_SHADER</span>);
<span class="hljs-keyword">const</span> fs = <span class="hljs-title function_">buildShader</span>(gl, fs_source, gl.<span class="hljs-property">FRAGMENT_SHADER</span>);
<span class="hljs-comment">// Create program on the GPU!</span>
<span class="hljs-keyword">const</span> program = <span class="hljs-title function_">createProgram</span>(gl, [vs, fs]);
<span class="hljs-comment">// Set current program (WebGL is a state machine!)</span>
gl.<span class="hljs-title function_">useProgram</span>(program);
<span class="hljs-comment">// Draw 1 big point, see shaders </span>
<span class="hljs-keyword">const</span> offset = <span class="hljs-number">0</span>;
<span class="hljs-keyword">const</span> count = <span class="hljs-number">1</span>;
gl.<span class="hljs-title function_">drawArrays</span>(gl.<span class="hljs-property">POINTS</span>, offset, count);
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="22" data-theme="gaia" style="--theme:gaia;"><iframe style=
"position: absolute;
top: 110px;
bottom: 110px;
left: 320px;
right: 320px;
width:100%;
height: 100%;
border: 0;" srcdoc ="
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<canvas width='640' height='480'></canvas>
<script>
const canvas = document.querySelector('canvas');
const gl = canvas.getContext('webgl'); // instead of '2d'
gl.clearColor(1., 0., 0., 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
// vertex shader
const vs_source = `
void main() {
gl_Position = vec4(0., 0., 0., 1.); // center
gl_PointSize = 120.0;
}`;
// fragment shader
const fs_source = `
precision mediump float;
void main() {
gl_FragColor = vec4(0., 1., 0., 1.); // green
}`;
function buildShader(gl, shaderSource, shaderType) {
const shader = gl.createShader(shaderType); // Create the shader object
gl.shaderSource(shader, shaderSource); // Load the shader source
gl.compileShader(shader); // Compile the shader
return shader;
}
function createProgram(gl, shaders) {
const program = gl.createProgram();
shaders.forEach(function(shader) {
gl.attachShader(program, shader);
});
gl.linkProgram(program);
return program;
}
// load and compile the shaders
const vs = buildShader(gl, vs_source, gl.VERTEX_SHADER);
const fs = buildShader(gl, fs_source, gl.FRAGMENT_SHADER);
// setup GLSL program
const program = createProgram(gl, [vs, fs]);
gl.useProgram(program);
// Draw 1 big point, see shaders
const offset = 0;
const count = 1;
gl.drawArrays(gl.POINTS, offset, count);
</script>
</body>
</html>" >
</iframe>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-paginate="true" data-theme="gaia" data-marpit-pagination="23" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("https://webglfundamentals.org/webgl/lessons/resources/webglfundamentals-webgl-state-diagram.jpg");background-size:contain;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="23" data-paginate="true" data-theme="gaia" data-marpit-pagination="23" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;" data-marpit-advanced-background="content">
<p><a href="https://webglfundamentals.org/webgl/lessons/resources/webgl-state-diagram.html?exampleId=smallest-glsl#no-help">Etats</a></p>
</section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-paginate="true" data-theme="gaia" data-marpit-pagination="23" data-marpit-pagination-total="126" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-background-color="#000000" data-class="lead invert" data-theme="gaia" class="lead invert" style="--background-color:#000000;--class:lead invert;--theme:gaia;background-color:#000000;background-image:none;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("http://webglworkshop.com/presentations/images/iknowwebgl.jpg");background-size:contain;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="24" data-background-color="#000000" data-class="lead invert" data-theme="gaia" class="lead invert" style="--background-color:#000000;--class:lead invert;--theme:gaia;background-color:#000000;background-image:none;" data-marpit-advanced-background="content"></section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-background-color="#000000" data-class="lead invert" data-theme="gaia" class="lead invert" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-background-color="#000000" data-class="lead invert" data-theme="gaia" class="lead invert" style="--background-color:#000000;--class:lead invert;--theme:gaia;background-color:#000000;background-image:none;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("http://webglworkshop.com/presentations/images/showme.jpg");background-size:contain;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="25" data-background-color="#000000" data-class="lead invert" data-theme="gaia" class="lead invert" style="--background-color:#000000;--class:lead invert;--theme:gaia;background-color:#000000;background-image:none;" data-marpit-advanced-background="content"></section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-background-color="#000000" data-class="lead invert" data-theme="gaia" class="lead invert" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-class="lead" data-theme="gaia" class="lead" style="--class:lead;--theme:gaia;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("http://webglworkshop.com/presentations/images/result.gif");background-size:contain;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="26" data-class="lead" data-theme="gaia" class="lead" style="--class:lead;--theme:gaia;" data-marpit-advanced-background="content"></section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-class="lead" data-theme="gaia" class="lead" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="27" data-paginate="true" data-class="lead invert" data-theme="gaia" class="lead invert" data-marpit-pagination="27" data-marpit-pagination-total="126" style="--paginate:true;--class:lead invert;--theme:gaia;">
<h1><a href="http://webglworkshop.com/presentations/Workshop28-webgl2.html">Mon premier triangle</a></h1>
<p>voir <a href="https://webglfundamentals.org/webgl/lessons/webgl-fundamentals.html">webglfundamentals</a></p>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="28" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="28" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h1>Initialisation</h1>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="29" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="29" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h2>1 . Data</h2>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="30" data-paginate="true" data-theme="gaia" data-marpit-pagination="30" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<ul>
<li>Description de la géométrie, avec des <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array">Float32Array</a></li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"><span class="hljs-keyword">const</span> vertices = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Float32Array</span>([
<span class="hljs-number">0.5</span>, <span class="hljs-number">0.5</span>,
-<span class="hljs-number">0.5</span>, <span class="hljs-number">0.5</span>,
-<span class="hljs-number">0.5</span>, -<span class="hljs-number">0.5</span>]); <span class="hljs-comment">// 2D points: 3 * (x, y) coordinates </span>
</code></pre>
<ul>
<li>Création du Vertex Buffer Object (VBO) + <strong>UPLOAD</strong> vers le GPU</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"><span class="hljs-keyword">const</span> vbo = gl.<span class="hljs-title function_">createBuffer</span>(); <span class="hljs-comment">// create Vertex Buffer Object (VBO) id</span>
<span class="hljs-comment">// Set current VBO: bind 'vbo' to the ARRAY_BUFFER bind point,</span>
<span class="hljs-comment">// a global variable internal to WebGL (state machine!)</span>
gl.<span class="hljs-title function_">bindBuffer</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, vbo);
<span class="hljs-comment">// UPLOAD current VBO to GPU, where it will be processed by the shaders</span>
<span class="hljs-comment">// <span class="hljs-doctag">NOTE:</span> STATIC_DRAW: hint for WebGL: our data won't change</span>
gl.<span class="hljs-title function_">bufferData</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, vertices, gl.<span class="hljs-property">STATIC_DRAW</span>);
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="31" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="31" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h2>2 . Shaders</h2>
<p>qui utilisent les données du buffer</p>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="32" data-paginate="true" data-footer="https://webglfundamentals.org/webgl/lessons/webgl-precision-issues.html)" data-theme="gaia" data-marpit-pagination="32" data-marpit-pagination-total="126" style="--paginate:true;--footer:https://webglfundamentals.org/webgl/lessons/webgl-precision-issues.html);--theme:gaia;">
<ul>
<li>Vertex Shader: gl_Position sera utilisée par le fragment shader</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-glsl"> <span class="hljs-keyword">attribute</span> <span class="hljs-type">vec2</span> a_position; <span class="hljs-comment">// IN, from buffer: 2D point</span>
<span class="hljs-type">void</span> main() {
<span class="hljs-built_in">gl_Position</span> = <span class="hljs-type">vec4</span>(a_position, <span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>); <span class="hljs-comment">// a_position.x, a_position.y, 0, 1, used by the fragment shader</span>
}
</code></pre>
<ul>
<li>Fragment Shader</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-glsl"> <span class="hljs-keyword">precision</span> <span class="hljs-keyword">mediump</span> <span class="hljs-type">float</span>; <span class="hljs-comment">// float accuracy: lowp, mediump, highp</span>
<span class="hljs-keyword">uniform</span> <span class="hljs-type">vec4</span> u_color; <span class="hljs-comment">// UNIFORM == CONSTANT for entire shader program</span>
<span class="hljs-type">void</span> main() {
<span class="hljs-built_in">gl_FragColor</span> = u_color; <span class="hljs-comment">// final framebuffer color: RGBA</span>
}
</code></pre>
<footer><a href="https://webglfundamentals.org/webgl/lessons/webgl-precision-issues.html">https://webglfundamentals.org/webgl/lessons/webgl-precision-issues.html</a>)</footer>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="33" data-paginate="true" data-theme="gaia" data-marpit-pagination="33" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<h1>Détection des erreurs de compilation</h1>
<p>À appeler avant glUseProgram, optionnel mais bien utile <img class="emoji" draggable="false" alt="😉" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f609.svg" data-marp-twemoji=""/></p>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"><span class="hljs-keyword">function</span> <span class="hljs-title function_">checkShaders</span>(<span class="hljs-params">gl, vs, fs, program</span>) {
<span class="hljs-keyword">if</span> (!gl.<span class="hljs-title function_">getShaderParameter</span>(vs, gl.<span class="hljs-property">COMPILE_STATUS</span>))
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(gl.<span class="hljs-title function_">getShaderInfoLog</span>(vs));
<span class="hljs-keyword">if</span> (!gl.<span class="hljs-title function_">getShaderParameter</span>(fs, gl.<span class="hljs-property">COMPILE_STATUS</span>))
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(gl.<span class="hljs-title function_">getShaderInfoLog</span>(fs));
<span class="hljs-keyword">if</span> (!gl.<span class="hljs-title function_">getProgramParameter</span>(program, gl.<span class="hljs-property">LINK_STATUS</span>))
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(gl.<span class="hljs-title function_">getProgramInfoLog</span>(program));
}
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="34" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="34" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h2>3 . Connexion entre Buffer et Shaders</h2>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="35" data-paginate="true" data-theme="gaia" data-marpit-pagination="35" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<ul>
<li>
<p>Récupération des variables utilisées dans les shaders</p>
<ul>
<li>appel potentiellement coûteux</li>
<li>à effectuer à l'initialisation</li>
<li>sera utilisé lors du rendu</li>
</ul>
</li>
<li>
<p><img class="emoji" draggable="false" alt="⚠️" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/26a0.svg" data-marp-twemoji=""/> respecter le même nom que celui défini dans le shader</p>
<ul>
<li>nom arbitraire, choisi par le développeur!</li>
</ul>
</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"><span class="hljs-comment">// Retrieve 'u_color' shader UNIFORM variable as an id</span>
<span class="hljs-keyword">const</span> u_colorLoc = gl.<span class="hljs-title function_">getUniformLocation</span>(program, <span class="hljs-string">'u_color'</span>);
<span class="hljs-comment">// Retrieve 'a_position' shader ATTRIBUTE variable as an id</span>
<span class="hljs-keyword">const</span> a_positionLoc = gl.<span class="hljs-title function_">getAttribLocation</span>(program, <span class="hljs-string">'a_position'</span>);
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="36" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="36" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h2>4 . Rendu!</h2>
<p>Les buffers, les shaders sont en place, il faut encore:</p>
<ul>
<li>définir des états</li>
<li>décrire le layout du buffer (souvent complexe!)</li>
<li>donner des instructions pour dessiner la scène</li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="37" data-paginate="true" data-footer="https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer" data-theme="gaia" data-marpit-pagination="37" data-marpit-pagination-total="126" style="--paginate:true;--footer:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer;--theme:gaia;">
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"> gl.<span class="hljs-title function_">clearColor</span>(<span class="hljs-number">0.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">1.</span>); <span class="hljs-comment">// Set current clear color (black)</span>
gl.<span class="hljs-title function_">clear</span>(gl.<span class="hljs-property">COLOR_BUFFER_BIT</span>); <span class="hljs-comment">// Clear the canvas to current color</span>
gl.<span class="hljs-title function_">useProgram</span>(program); <span class="hljs-comment">// Set current program (pair of shaders)</span>
<span class="hljs-comment">// Set the color (constant triangle color, see shader)</span>
gl.<span class="hljs-title function_">uniform4fv</span>(u_colorLoc, [<span class="hljs-number">1.0</span>, <span class="hljs-number">0.0</span>, <span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>]);
<span class="hljs-comment">// Tell WebGL how to take data from the VBO</span>
<span class="hljs-comment">// and supply it to the attribute in the shader.</span>
gl.<span class="hljs-title function_">enableVertexAttribArray</span>(a_positionLoc); <span class="hljs-comment">// Turn the attribute on</span>
gl.<span class="hljs-title function_">bindBuffer</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, vbo); <span class="hljs-comment">// set current vbo</span>
<span class="hljs-comment">// Tell the attribute how to get data out of positionBuffer</span>
<span class="hljs-comment">// (ARRAY_BUFFER)</span>
<span class="hljs-keyword">const</span> size = <span class="hljs-number">2</span>; <span class="hljs-comment">// 2 components per iteration</span>
<span class="hljs-keyword">const</span> type = gl.<span class="hljs-property">FLOAT</span>; <span class="hljs-comment">// the data is 32bit floats</span>
<span class="hljs-keyword">const</span> normalize = <span class="hljs-literal">false</span>; <span class="hljs-comment">// don't normalize the data</span>
<span class="hljs-comment">// stride: 0 = move forward size * sizeof(type) each iteration</span>
<span class="hljs-comment">// to get the next position</span>
<span class="hljs-keyword">const</span> stride = <span class="hljs-number">0</span>;
<span class="hljs-keyword">const</span> offset = <span class="hljs-number">0</span>; <span class="hljs-comment">// start at the beginning of the buffer</span>
gl.<span class="hljs-title function_">vertexAttribPointer</span>(a_positionLoc, size, type, normalize, stride, offset);
</code></pre>
<footer><a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer">https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer</a></footer>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="38" data-paginate="true" data-theme="gaia" data-marpit-pagination="38" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<ul>
<li>Rendu, avec <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawArrays">drawArrays</a></li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"> <span class="hljs-comment">// primitiveType == gl.TRIANGLES:</span>
<span class="hljs-comment">// each time our vertex shader is run 3 times,</span>
<span class="hljs-comment">// WebGL will draw a triangle</span>
<span class="hljs-comment">// based on the 3 values we set gl_Position to (see shader)</span>
<span class="hljs-keyword">const</span> primitiveType = gl.<span class="hljs-property">TRIANGLES</span>;
<span class="hljs-comment">// Start index of the first vertex</span>
<span class="hljs-comment">// Must be a valid multiple of the size of the given type.</span>
<span class="hljs-keyword">const</span> startIndex = <span class="hljs-number">0</span>;
<span class="hljs-comment">// Execute our vertex shader 3 times,</span>
<span class="hljs-comment">// using 2 elements from the array (see size 2 above)</span>
<span class="hljs-comment">// setting a_position.x and a_position.y</span>
<span class="hljs-keyword">const</span> count = <span class="hljs-number">3</span>;
gl.<span class="hljs-title function_">drawArrays</span>(primitiveType, startIndex, count);
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="39" data-class="lead" data-theme="gaia" class="lead" style="--class:lead;--theme:gaia;"><iframe style=
"position: absolute;
top: 110px;
bottom: 110px;
left: 320px;
right: 320px;
width:100%;
height: 100%;
border: 0;" srcdoc ="
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<canvas width='640' height='480'></canvas>
<script>
const canvas = document.querySelector('canvas');
const gl = canvas.getContext('webgl'); // instead of '2d'
gl.clearColor(0., 0., 0., 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
// vertex shader
const vs_source = `
attribute vec2 a_position; // in, from buffer: 2D point
void main() {
gl_Position = vec4(a_position, 0.0, 1.0); // a_position.x, a_position.y, 0, 1
}
`;
// fragment shader
const fs_source = `
precision mediump float; // float accuracy: lowp, mediump, highp
uniform vec4 u_color; // UNIFORM == CONSTANT for entire shader program
void main() {
gl_FragColor = u_color; // final framebuffer color: RGBA
}
`;
function buildShader(gl, shaderSource, shaderType) {
const shader = gl.createShader(shaderType); // Create the shader object
gl.shaderSource(shader, shaderSource); // Load the shader source
gl.compileShader(shader); // Compile the shader
return shader;
}
function createProgram(gl, shaders) {
const program = gl.createProgram();
shaders.forEach(function(shader) {
gl.attachShader(program, shader);
});
gl.linkProgram(program);
return program;
}
// load and compile the shaders
const vs = buildShader(gl, vs_source, gl.VERTEX_SHADER);
const fs = buildShader(gl, fs_source, gl.FRAGMENT_SHADER);
// setup GLSL program
const program = createProgram(gl, [vs, fs]);
function checkShaders(gl, vs, fs, program) {
if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) {
console.error(gl.getShaderInfoLog(vs));
}
if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) {
console.error(gl.getShaderInfoLog(fs));
}
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
console.error(gl.getProgramInfoLog(program));
}
}
checkShaders(gl, vs, fs, program);
const vertices = new Float32Array([
0.5, 0.5,
-0.5, 0.5,
-0.5, -0.5]); // 2D points: 3 * (x, y) coordinates
const vbo = gl.createBuffer(); // create Vertex Buffer Object (VBO) id
gl.bindBuffer(gl.ARRAY_BUFFER, vbo); // set current VBO (WebGL is a state machine!)
// UPLOAD current VBO to GPU,
// where it will be processed by the shaders
// NOTE: STATIC_DRAW: hint for WebGL: our data won't change
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
// Retrieve 'u_color' shader UNIFORM variable as an id
const u_colorLoc = gl.getUniformLocation(program, 'u_color');
// Retrieve 'a_position' shader ATTRIBUTE variable as an id
const a_positionLoc = gl.getAttribLocation(program, 'a_position');
gl.clearColor(0., 0., 0., 1.); // Set current clear color (black)
gl.clear(gl.COLOR_BUFFER_BIT); // Clear the canvas to current color
gl.useProgram(program); // Set current program (pair of shaders)
// Set the color (constant triangle color, see shader)
gl.uniform4fv(u_colorLoc, [1.0, 0.0, 0.0, 1.0]);
// Tell WebGL how to take data from the VBO
// and supply it to the attribute in the shader.
gl.enableVertexAttribArray(a_positionLoc); // Turn the attribute on
gl.bindBuffer(gl.ARRAY_BUFFER, vbo); // set current vbo
// Tell the attribute how to get data out of positionBuffer
// (ARRAY_BUFFER)
const size = 2; // 2 components per iteration
const type = gl.FLOAT; // the data is 32bit floats
const normalize = false; // don't normalize the data
// stride: 0 = move forward size * sizeof(type) each iteration
// to get the next position
const stride = 0;
const offset = 0; // start at the beginning of the buffer
gl.vertexAttribPointer(a_positionLoc, size, type, normalize, stride, offset);
// primitiveType == gl.TRIANGLES:
// each time our vertex shader is run 3 times,
// WebGL will draw a triangle
// based on the 3 values we set gl_Position to (see shader)
const primitiveType = gl.TRIANGLES;
// Start index of the first vertex
const startIndex = 0;
// Execute our vertex shader 3 times,
// using 2 elements from the array (see size 2 above)
// setting a_position.x and a_position.y
const count = 3;
gl.drawArrays(primitiveType, startIndex, count);
</script>
</body>
</html>" >
</iframe>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-paginate="true" data-theme="gaia" data-marpit-pagination="40" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("https://webglfundamentals.org/webgl/lessons/resources/webglfundamentals-webgl-state-diagram.jpg");background-size:contain;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="40" data-paginate="true" data-theme="gaia" data-marpit-pagination="40" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;" data-marpit-advanced-background="content">
<p><a href="https://webglfundamentals.org/webgl/lessons/resources/webgl-state-diagram.html?exampleId=rainbow-triangle#no-help">Etats</a></p>
</section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-paginate="true" data-theme="gaia" data-marpit-pagination="40" data-marpit-pagination-total="126" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="41" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="41" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h1>Presque!</h1>
<p>Il faut ajouter une couleur par vertex<br />
au lieu de la couleur de type <code>uniform</code><br />
cf. <a href="https://webglfundamentals.org/webgl/lessons/webgl-how-it-works.html">webglfundamentals</a></p>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="42" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="42" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h2>1 . Data</h2>
<p>on ajoute un attribut de couleur par vertex<br />
avec un nouveau tableau, et un nouveau buffer!</p>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="43" data-paginate="true" data-theme="gaia" data-marpit-pagination="43" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"> <span class="hljs-comment">// 2D points: 3 * (x, y) coordinates </span>
<span class="hljs-comment">// (sqrt(3) / 2 - 0.5) * 640 / 480 == 0.4880338..</span>
<span class="hljs-keyword">const</span> vertices = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Float32Array</span>([-<span class="hljs-number">0.75</span>, -<span class="hljs-number">0.5</span>,
<span class="hljs-number">0.75</span>, -<span class="hljs-number">0.5</span>,
<span class="hljs-number">0.</span>, <span class="hljs-number">0.49</span>]);
<span class="hljs-comment">// create Vertex Buffer Object (VBO) id</span>
<span class="hljs-keyword">const</span> vertexBuffer = gl.<span class="hljs-title function_">createBuffer</span>();
<span class="hljs-comment">// set current VBO (WebGL is a state machine!)</span>
gl.<span class="hljs-title function_">bindBuffer</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, vertexBuffer);
<span class="hljs-comment">// UPLOAD vertexBuffer VBO to GPU,</span>
gl.<span class="hljs-title function_">bufferData</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, vertices, gl.<span class="hljs-property">STATIC_DRAW</span>);
<span class="hljs-comment">// ** NEW **</span>
<span class="hljs-comment">// RGB colors: 3 * (r, g, b, a) values</span>
<span class="hljs-keyword">const</span> colors = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Float32Array</span>([ <span class="hljs-number">1.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">1.</span>,
<span class="hljs-number">0.</span>, <span class="hljs-number">1.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">1.</span>,
<span class="hljs-number">0.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">1.</span>, <span class="hljs-number">1.</span>]);
<span class="hljs-comment">// create Vertex Buffer Object (VBO) id</span>
<span class="hljs-keyword">const</span> colorBuffer = gl.<span class="hljs-title function_">createBuffer</span>();
<span class="hljs-comment">// set current VBO (WebGL is a state machine!)</span>
gl.<span class="hljs-title function_">bindBuffer</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, colorBuffer);
<span class="hljs-comment">// UPLOAD colorBuffer VBO to GPU,</span>
gl.<span class="hljs-title function_">bufferData</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, colors, gl.<span class="hljs-property">STATIC_DRAW</span>);
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="44" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="44" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h2>2 . Shaders</h2>
<p>on utilise le nouvel attribut de couleur, que l'on nomme <code>a_color</code><br />
(ou <code>mapetitecouleurparvertex</code> mais ça fait moins pro)</p>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="45" data-paginate="true" data-theme="gaia" data-marpit-pagination="45" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<ul>
<li>Vertex Shader: nouvelle variable de type <code>varying</code></li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-glsl"> <span class="hljs-keyword">attribute</span> <span class="hljs-type">vec2</span> a_position; <span class="hljs-comment">// IN, from buffer: 2D point</span>
<span class="hljs-keyword">attribute</span> <span class="hljs-type">vec3</span> a_color; <span class="hljs-comment">// IN, from buffer: RGB color</span>
<span class="hljs-keyword">varying</span> <span class="hljs-type">vec3</span> v_color; <span class="hljs-comment">// OUT, to fragment shader</span>
<span class="hljs-type">void</span> main() {
v_color = a_color; <span class="hljs-comment">// color passthrough, sent to fragment shader</span>
<span class="hljs-built_in">gl_Position</span> = <span class="hljs-type">vec4</span>(a_position, <span class="hljs-number">0.0</span>, <span class="hljs-number">1.0</span>); <span class="hljs-comment">// used by the fragment shader</span>
}
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="46" data-paginate="true" data-theme="gaia" data-marpit-pagination="46" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<ul>
<li>Fragment Shader</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-glsl"> <span class="hljs-keyword">precision</span> <span class="hljs-keyword">mediump</span> <span class="hljs-type">float</span>; <span class="hljs-comment">// float accuracy: lowp, mediump, highp</span>
<span class="hljs-keyword">varying</span> <span class="hljs-type">vec3</span> v_color; <span class="hljs-comment">// IN, INTERPOLATED color from vertex shader</span>
<span class="hljs-type">void</span> main() {
<span class="hljs-built_in">gl_FragColor</span> = <span class="hljs-type">vec4</span>(v_color, <span class="hljs-number">1.</span>); <span class="hljs-comment">// final framebuffer color: RGBA</span>
}
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="47" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="47" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h2>3 . Connexion entre Buffers et Shaders</h2>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="48" data-paginate="true" data-theme="gaia" data-marpit-pagination="48" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<ul>
<li>
<p>Récupération des variables utilisées dans les shaders</p>
<ul>
<li>appel potentiellement coûteux</li>
<li>à effectuer à l'initialisation</li>
<li>seront utilisées lors du rendu</li>
</ul>
</li>
<li>
<p><img class="emoji" draggable="false" alt="⚠️" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/26a0.svg" data-marp-twemoji=""/> respecter les noms définis dans le shader</p>
</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript">
<span class="hljs-comment">// Retrieve 'a_color' shader ATTRIBUTE variable as an id</span>
<span class="hljs-keyword">const</span> a_colorLoc = gl.<span class="hljs-title function_">getAttribLocation</span>(program, <span class="hljs-string">'a_color'</span>);
<span class="hljs-comment">// Retrieve 'a_position' shader ATTRIBUTE variable as an id</span>
<span class="hljs-keyword">const</span> a_positionLoc = gl.<span class="hljs-title function_">getAttribLocation</span>(program, <span class="hljs-string">'a_position'</span>);
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="49" data-paginate="true" data-class="lead" data-theme="gaia" class="lead" data-marpit-pagination="49" data-marpit-pagination-total="126" style="--paginate:true;--class:lead;--theme:gaia;">
<h2>4 . Rendu!</h2>
<p>Les buffers, les shaders sont en place, reste à:</p>
<ul>
<li>définir des états</li>
<li>décrire le layout du buffer</li>
<li>donner des instructions pour dessiner la scène</li>
</ul>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="50" data-paginate="true" data-theme="gaia" data-marpit-pagination="50" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"> gl.<span class="hljs-title function_">clearColor</span>(<span class="hljs-number">0.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">0.</span>, <span class="hljs-number">1.</span>);
gl.<span class="hljs-title function_">clear</span>(gl.<span class="hljs-property">COLOR_BUFFER_BIT</span>);
gl.<span class="hljs-title function_">useProgram</span>(program); <span class="hljs-comment">// Set current program</span>
{
<span class="hljs-comment">// Turn the attribute on</span>
gl.<span class="hljs-title function_">enableVertexAttribArray</span>(a_positionLoc);
gl.<span class="hljs-title function_">bindBuffer</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, vertexBuffer); <span class="hljs-comment">// set current vbo</span>
<span class="hljs-comment">// Tell the attribute how to get data out of positionBuffer</span>
<span class="hljs-comment">// (ARRAY_BUFFER)</span>
<span class="hljs-keyword">const</span> size = <span class="hljs-number">2</span>; <span class="hljs-comment">// 2 components per iteration</span>
<span class="hljs-keyword">const</span> type = gl.<span class="hljs-property">FLOAT</span>; <span class="hljs-comment">// the data is 32bit floats</span>
<span class="hljs-keyword">const</span> normalize = <span class="hljs-literal">false</span>; <span class="hljs-comment">// don't normalize the data</span>
<span class="hljs-comment">// stride: 0 = move forward size * sizeof(type) each iteration</span>
<span class="hljs-comment">// to get the next position</span>
<span class="hljs-keyword">const</span> stride = <span class="hljs-number">0</span>;
<span class="hljs-keyword">const</span> offset = <span class="hljs-number">0</span>; <span class="hljs-comment">// start at the beginning of the buffer</span>
gl.<span class="hljs-title function_">vertexAttribPointer</span>(a_positionLoc, size, type, normalize, stride, offset);
}
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="51" data-paginate="true" data-theme="gaia" data-marpit-pagination="51" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<ul>
<li>Mêmes étapes pour le colorBuffer<br />
NOTE: Refactoring! Dans la vraie vie on évite de se répéter: <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a></li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript">{
<span class="hljs-comment">// Tell WebGL how to take data from the VBO</span>
<span class="hljs-comment">// and supply it to the attribute in the shader.</span>
gl.<span class="hljs-title function_">enableVertexAttribArray</span>(a_colorLoc); <span class="hljs-comment">// Turn the attribute on</span>
gl.<span class="hljs-title function_">bindBuffer</span>(gl.<span class="hljs-property">ARRAY_BUFFER</span>, colorBuffer);
<span class="hljs-comment">// Tell the color attribute how to get data out of colorBuffer (ARRAY_BUFFER)</span>
<span class="hljs-keyword">const</span> size = <span class="hljs-number">4</span>; <span class="hljs-comment">// <span class="hljs-doctag">NOTE:</span> 4 components per iteration</span>
<span class="hljs-keyword">const</span> type = gl.<span class="hljs-property">FLOAT</span>; <span class="hljs-comment">// the data is 32bit floats</span>
<span class="hljs-keyword">const</span> normalize = <span class="hljs-literal">false</span>; <span class="hljs-comment">// don't normalize the data</span>
<span class="hljs-comment">// stride: 0 = move forward size * sizeof(type) each iteration</span>
<span class="hljs-comment">// to get the next position</span>
<span class="hljs-keyword">const</span> stride = <span class="hljs-number">0</span>;
<span class="hljs-keyword">const</span> offset = <span class="hljs-number">0</span>; <span class="hljs-comment">// start at the beginning of the buffer</span>
gl.<span class="hljs-title function_">vertexAttribPointer</span>( a_colorLoc, size, type, normalize, stride, offset);
}
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="52" data-paginate="true" data-theme="gaia" data-marpit-pagination="52" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;">
<ul>
<li>Rendu: code inchangé!</li>
</ul>
<pre is="marp-pre" data-auto-scaling="downscale-only"><code class="language-javascript"> <span class="hljs-comment">// primitiveType == gl.TRIANGLES:</span>
<span class="hljs-comment">// each time our vertex shader is run 3 times,</span>
<span class="hljs-comment">// WebGL will draw a triangle</span>
<span class="hljs-comment">// based on the 3 values we set gl_Position to (see shader)</span>
<span class="hljs-keyword">const</span> primitiveType = gl.<span class="hljs-property">TRIANGLES</span>;
<span class="hljs-comment">// Start index of the first vertex</span>
<span class="hljs-comment">// Must be a valid multiple of the size of the given type.</span>
<span class="hljs-keyword">const</span> startIndex = <span class="hljs-number">0</span>;
<span class="hljs-comment">// Execute our vertex shader 3 times,</span>
<span class="hljs-comment">// using 2 elements from the array (see size 2 above)</span>
<span class="hljs-comment">// setting a_position.x and a_position.y</span>
<span class="hljs-keyword">const</span> count = <span class="hljs-number">3</span>;
gl.<span class="hljs-title function_">drawArrays</span>(primitiveType, startIndex, count);
</code></pre>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="53" data-theme="gaia" style="--theme:gaia;"><iframe style=
"position: absolute;
top: 110px;
bottom: 110px;
left: 320px;
right: 320px;
width:100%;
height: 100%;
border: 0;" srcdoc ="
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<canvas width='640' height='480'></canvas>
<script>
const canvas = document.querySelector('canvas');
const gl = canvas.getContext('webgl'); // instead of '2d'
gl.clearColor(0., 0., 0., 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
// vertex shader
const vs_source = `
attribute vec2 a_position; // IN, from buffer: 2D point
attribute vec3 a_color; // IN, from buffer: RGB color
varying vec3 v_color; // OUT, to fragment shader
void main() {
v_color = a_color; // color passthrough, sent to fragment shader
gl_Position = vec4(a_position, 0.0, 1.0); // used by the fragment shader
}
`;
// fragment shader
const fs_source = `
precision mediump float; // float accuracy: lowp, mediump, highp
varying vec3 v_color; // IN, INTERPOLATED color from vertex shader
void main() {
gl_FragColor = vec4(v_color, 1.); // final framebuffer color: RGBA
}
`;
function buildShader(gl, shaderSource, shaderType) {
const shader = gl.createShader(shaderType); // Create the shader object
gl.shaderSource(shader, shaderSource); // Load the shader source
gl.compileShader(shader); // Compile the shader
return shader;
}
function createProgram(gl, shaders) {
const program = gl.createProgram();
shaders.forEach(function(shader) {
gl.attachShader(program, shader);
});
gl.linkProgram(program);
return program;
}
// load and compile the shaders
const vs = buildShader(gl, vs_source, gl.VERTEX_SHADER);
const fs = buildShader(gl, fs_source, gl.FRAGMENT_SHADER);
// setup GLSL program
const program = createProgram(gl, [vs, fs]);
function checkShaders(gl, vs, fs, program) {
if (!gl.getShaderParameter(vs, gl.COMPILE_STATUS)) {
console.error(gl.getShaderInfoLog(vs));
}
if (!gl.getShaderParameter(fs, gl.COMPILE_STATUS)) {
console.error(gl.getShaderInfoLog(fs));
}
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
console.error(gl.getProgramInfoLog(program));
}
}
checkShaders(gl, vs, fs, program);
// 2D points: 3 * (x, y) coordinates
const vertices = new Float32Array([-0.5, -0.5,
0.5, -0.5,
0., 0.49]);
// create Vertex Buffer Object (VBO) id
const vertexBuffer = gl.createBuffer();
// set current VBO (WebGL is a state machine!)
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
// UPLOAD vertexBuffer VBO to GPU,
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
// ** NEW **
// RGB colors: 3 * (r, g, b) values
const colors = new Float32Array([ 1., 0., 0., 1.,
0., 1., 0., 1.,
0., 0., 1., 1.]);
// create Vertex Buffer Object (VBO) id
// create Vertex Buffer Object (VBO) id
const colorBuffer = gl.createBuffer();
// set current VBO (WebGL is a state machine!)
gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);
// UPLOAD colorBuffer VBO to GPU,
gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW);
// Retrieve 'a_color' shader ATTRIBUTE variable as an id
const a_colorLoc = gl.getAttribLocation(program, 'a_color');
// Retrieve 'a_position' shader ATTRIBUTE variable as an id
const a_positionLoc = gl.getAttribLocation(program, 'a_position');
gl.clearColor(0., 0., 0., 1.);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.useProgram(program); // Set current program
{
// Turn the attribute on
gl.enableVertexAttribArray(a_positionLoc);
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); // set current vbo
// Tell the attribute how to get data out of positionBuffer
// (ARRAY_BUFFER)
const size = 2; // 2 components per iteration
const type = gl.FLOAT; // the data is 32bit floats
const normalize = false; // don't normalize the data
// stride: 0 = move forward size * sizeof(type) each iteration
// to get the next position
const stride = 0;
const offset = 0; // start at the beginning of the buffer
gl.vertexAttribPointer(
a_positionLoc, size, type, normalize, stride, offset);
}
{
// Tell WebGL how to take data from the VBO
// and supply it to the attribute in the shader.
gl.enableVertexAttribArray(a_colorLoc); // Turn the attribute on
gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);
// Tell the color attribute how to get data out of colorBuffer (ARRAY_BUFFER)
var size = 4; // 4 components per iteration
var type = gl.FLOAT; // the data is 32bit floats
var normalize = false; // don't normalize the data
// stride: 0 = move forward size * sizeof(type) each iteration
// to get the next position
var stride = 0;
var offset = 0; // start at the beginning of the buffer
gl.vertexAttribPointer( a_colorLoc, size, type, normalize, stride, offset);
}
// primitiveType == gl.TRIANGLES:
// each time our vertex shader is run 3 times,
// WebGL will draw a triangle
// based on the 3 values we set gl_Position to (see shader)
const primitiveType = gl.TRIANGLES;
// Start index of the first vertex
const startIndex = 0;
// Execute our vertex shader 3 times,
// using 2 elements from the array (see size 2 above)
// setting a_position.x and a_position.y
const count = 3;
gl.drawArrays(primitiveType, startIndex, count);
</script>
</body>
</html> ">
</iframe>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section data-paginate="true" data-theme="gaia" data-marpit-pagination="54" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;" data-marpit-advanced-background="background"><div data-marpit-advanced-background-container="true" data-marpit-advanced-background-direction="horizontal"><figure style="background-image:url("https://webglfundamentals.org/webgl/lessons/resources/webglfundamentals-webgl-state-diagram.jpg");background-size:contain;"></figure></div></section></foreignObject><foreignObject width="1280" height="720"><section id="54" data-paginate="true" data-theme="gaia" data-marpit-pagination="54" data-marpit-pagination-total="126" style="--paginate:true;--theme:gaia;" data-marpit-advanced-background="content">
<p><a href="https://webglfundamentals.org/webgl/lessons/resources/webgl-state-diagram.html?exampleId=rainbow-triangle#no-help">Etats</a></p>
</section>
</foreignObject><foreignObject width="1280" height="720" data-marpit-advanced-background="pseudo"><section data-paginate="true" data-theme="gaia" data-marpit-pagination="54" data-marpit-pagination-total="126" style="" data-marpit-advanced-background="pseudo"></section></foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="55" data-class="lead invert" data-theme="gaia" class="lead invert" style="--class:lead invert;--theme:gaia;">
<h1><img class="emoji" draggable="false" alt="💪" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f4aa.svg" data-marp-twemoji=""/> <img class="emoji" draggable="false" alt="😎" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f60e.svg" data-marp-twemoji=""/> <img class="emoji" draggable="false" alt="🎉" src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14.0.2/assets/svg/1f389.svg" data-marp-twemoji=""/></h1>
</section>
</foreignObject></svg><svg data-marpit-svg="" viewBox="0 0 1280 720"><foreignObject width="1280" height="720"><section id="56" data-paginate="true" data-class="lead invert" data-theme="gaia" class="lead invert" data-marpit-pagination="56" data-marpit-pagination-total="126" style="--paginate:true;--class:lead invert;--theme:gaia;">
<h1>Variantes</h1>
<ul>
<li><a href="http://www.webglacademy.com/courses.php?courses=0_1_20_2_3_4_23_5_6_7_10#1">Un seul buffer entrelacé</a>, et indexé + gl.DrawElements
<ul>
<li>est-ce vraiment une <a href="https://www.khronos.org/opengl/wiki/Vertex_Specification_Best_Practices">optimisation</a>?</li>