@@ -19,7 +19,7 @@ <h2 class="subtitle" id="copyright-c-2018-nicolas-p-rougier-nicolas-rougier-inri
19
19
<img alt="images/sa.large.png" src="images/sa.large.png" style="width: 32px;" />
20
20
<img alt="images/nc.large.png" src="images/nc.large.png" style="width: 32px;" />
21
21
<div class="line-block">
22
- <div class="line">Latest version - September 2018</div>
22
+ <div class="line">Latest version - October 2018</div>
23
23
<div class="line"><a class="reference external" href="http://www.labri.fr/perso/nrougier/python-opengl">www.labri.fr/perso/nrougier/python-opengl</a></div>
24
24
</div>
25
25
</div>
@@ -1441,7 +1441,6 @@ <h3><a class="toc-backref" href="#id7">Varying color</a></h3>
1441
1441
1442
1442
.. figure:: movies/chapter-03/quad-scale.mp4
1443
1443
:loop:
1444
- :autoplay:
1445
1444
:controls:
1446
1445
:figwidth: 35%
1447
1446
@@ -1494,7 +1493,7 @@ <h2><a class="toc-backref" href="#id7">Exercises</a></h2>
1494
1493
taste in the three exercises below but we'll see much more powerful shader
1495
1494
tricks in the next chapters.</p>
1496
1495
<div class="right figure" id="figure-movies/chapter-03/quad-scale.mp4" style="width: 35%">
1497
- <video autoplay="True" controls="True" loop="True">
1496
+ <video controls="True" loop="True">
1498
1497
<source src="movies/chapter-03/quad-scale.mp4"></source>
1499
1498
</video>
1500
1499
<p class="caption">Figure</p>
@@ -1511,7 +1510,7 @@ <h2><a class="toc-backref" href="#id7">Exercises</a></h2>
1511
1510
<p>Solution: <a class="reference external" href="code/chapter-03/quad-scale.py">code/chapter-03/quad-scale.py</a></p>
1512
1511
<hr class="docutils" />
1513
1512
<div class="right figure" id="figure-movies/chapter-03/quad-rotate.mp4" style="width: 35%">
1514
- <video autoplay="True" controls="True" loop="True">
1513
+ <video controls="True" loop="True">
1515
1514
<source src="movies/chapter-03/quad-rotate.mp4"></source>
1516
1515
</video>
1517
1516
<p class="caption">Figure</p>
@@ -2095,7 +2094,7 @@ <h2><a class="toc-backref" href="#id15">Scene setup</a></h2>
2095
2094
<div class="section" id="actual-rendering">
2096
2095
<h2><a class="toc-backref" href="#id15">Actual rendering</a></h2>
2097
2096
<div class="right figure" id="figure-movies/chapter-05/solid-cube.mp4" style="width: 35%">
2098
- <video autoplay="True" controls="True" loop="True">
2097
+ <video controls="True" loop="True">
2099
2098
<source src="movies/chapter-05/solid-cube.mp4"></source>
2100
2099
</video>
2101
2100
<p class="caption">Figure</p>
@@ -2161,7 +2160,7 @@ <h3><a class="toc-backref" href="#id15">Colored cube</a></h3>
2161
2160
<span class="punctuation">}</span> <span class="error">"""</span>
2162
2161
</pre>
2163
2162
<div class="right figure" id="figure-movies/chapter-05/color-cube.mp4" style="width: 35%">
2164
- <video autoplay="True" controls="True" loop="True">
2163
+ <video controls="True" loop="True">
2165
2164
<source src="movies/chapter-05/color-cube.mp4"></source>
2166
2165
</video>
2167
2166
<p class="caption">Figure</p>
@@ -2185,7 +2184,7 @@ <h3><a class="toc-backref" href="#id15">Colored cube</a></h3>
2185
2184
<div class="section" id="outlined-cube">
2186
2185
<h3><a class="toc-backref" href="#id15">Outlined cube</a></h3>
2187
2186
<div class="right figure" id="figure-movies/chapter-05/outline-cube.mp4" style="width: 35%">
2188
- <video autoplay="True" controls="True" loop="True">
2187
+ <video controls="True" loop="True">
2189
2188
<source src="movies/chapter-05/outline-cube.mp4"></source>
2190
2189
</video>
2191
2190
<p class="caption">Figure</p>
@@ -2246,7 +2245,7 @@ <h3><a class="toc-backref" href="#id15">Outlined cube</a></h3>
2246
2245
<div class="section" id="textured-cube">
2247
2246
<h3><a class="toc-backref" href="#id15">Textured cube</a></h3>
2248
2247
<div class="right figure" id="figure-movies/chapter-05/texture-cube.mp4" style="width: 35%">
2249
- <video autoplay="True" controls="True" loop="True">
2248
+ <video controls="True" loop="True">
2250
2249
<source src="movies/chapter-05/texture-cube.mp4"></source>
2251
2250
</video>
2252
2251
<p class="caption">Figure</p>
@@ -2334,7 +2333,7 @@ <h3><a class="toc-backref" href="#id15">Textured cube</a></h3>
2334
2333
<div class="section" id="id16">
2335
2334
<h2><a class="toc-backref" href="#id15">Exercises</a></h2>
2336
2335
<div class="right figure" id="figure-movies/chapter-05/color-border-cube-1.mp4" style="width: 35%">
2337
- <video autoplay="True" controls="True" loop="True">
2336
+ <video controls="True" loop="True">
2338
2337
<source src="movies/chapter-05/color-border-cube-1.mp4"></source>
2339
2338
</video>
2340
2339
<p class="caption">Figure</p>
@@ -2353,7 +2352,7 @@ <h2><a class="toc-backref" href="#id15">Exercises</a></h2>
2353
2352
<p><strong>Solution</strong>: <a class="reference external" href="code/chapter-05/border-cube.py">code/chapter-05/border-cube.py</a></p>
2354
2353
<hr class="docutils" />
2355
2354
<div class="right figure" id="figure-movies/chapter-05/color-border-cube-2.mp4" style="width: 35%">
2356
- <video autoplay="True" controls="True" loop="True">
2355
+ <video controls="True" loop="True">
2357
2356
<source src="movies/chapter-05/color-border-cube-2.mp4"></source>
2358
2357
</video>
2359
2358
<p class="caption">Figure</p>
@@ -2577,7 +2576,7 @@ <h3><a class="toc-backref" href="#id25">Signed distance function</a></h3>
2577
2576
outside the circle.</p>
2578
2577
<p>Now, let's check if OpenGL is consistent with our maths. We'll write a fragment
2579
2578
shader that compute the color according to the distance to the shape. We'll use
2580
- the red color outside the circle, blue color inside and white color on the
2579
+ the blue color outside the circle, red color inside and white color on the
2581
2580
border (with some tolerance or we won't see anything).</p>
2582
2581
<pre class="code glsl literal-block">
2583
2582
<span class="keyword">float</span> <span class="name">distance</span><span class="punctuation">(</span><span class="keyword">vec2</span> <span class="name">P</span><span class="punctuation">,</span> <span class="keyword">vec2</span> <span class="name">center</span><span class="punctuation">,</span> <span class="keyword">float</span> <span class="name">radius</span><span class="punctuation">)</span>
@@ -2631,7 +2630,7 @@ <h3><a class="toc-backref" href="#id25">Geometrical primitives</a></h3>
2631
2630
<h4>Circle</h4>
2632
2631
<p>Distance to a circle is the easiest to compute.</p>
2633
2632
<div class="right figure" id="figure-movies/chapter-06/SDF-circle.mp4" style="width: 25%">
2634
- <video autoplay="True" controls="True" loop="True">
2633
+ <video controls="True" loop="True">
2635
2634
<source src="movies/chapter-06/SDF-circle.mp4"></source>
2636
2635
</video>
2637
2636
<p class="caption">Figure</p>
@@ -2650,7 +2649,7 @@ <h4>Plane</h4>
2650
2649
<p>The distance from a point P to a plane (line in 2d) is the distance from P to
2651
2650
the projection of P onto the place.</p>
2652
2651
<div class="right figure" id="figure-movies/chapter-06/SDF-plane.mp4" style="width: 25%">
2653
- <video autoplay="True" controls="True" loop="True">
2652
+ <video controls="True" loop="True">
2654
2653
<source src="movies/chapter-06/SDF-plane.mp4"></source>
2655
2654
</video>
2656
2655
<p class="caption">Figure</p>
@@ -2671,7 +2670,7 @@ <h4>True Box</h4>
2671
2670
<p>When computing distance to a box, one has to take care of the distance to the
2672
2671
vertices defining the box.</p>
2673
2672
<div class="right figure" id="figure-movies/chapter-06/SDF-box.mp4" style="width: 25%">
2674
- <video autoplay="True" controls="True" loop="True">
2673
+ <video controls="True" loop="True">
2675
2674
<source src="movies/chapter-06/SDF-box.mp4"></source>
2676
2675
</video>
2677
2676
<p class="caption">Figure</p>
@@ -2691,7 +2690,7 @@ <h4>True Box</h4>
2691
2690
<div class="section" id="rounded-box">
2692
2691
<h4>Rounded Box</h4>
2693
2692
<div class="right figure" id="figure-movies/chapter-06/SDF-round-box.mp4" style="width: 25%">
2694
- <video autoplay="True" controls="True" loop="True">
2693
+ <video controls="True" loop="True">
2695
2694
<source src="movies/chapter-06/SDF-round-box.mp4"></source>
2696
2695
</video>
2697
2696
<p class="caption">Figure</p>
@@ -2712,7 +2711,7 @@ <h4>Rounded Box</h4>
2712
2711
<div class="section" id="fake-box">
2713
2712
<h4>Fake Box</h4>
2714
2713
<div class="right figure" id="figure-movies/chapter-06/SDF-fake-box.mp4" style="width: 25%">
2715
- <video autoplay="True" controls="True" loop="True">
2714
+ <video controls="True" loop="True">
2716
2715
<source src="movies/chapter-06/SDF-fake-box.mp4"></source>
2717
2716
</video>
2718
2717
<p class="caption">Figure</p>
@@ -2732,7 +2731,7 @@ <h4>Fake Box</h4>
2732
2731
<div class="section" id="true-triangle">
2733
2732
<h4>True triangle</h4>
2734
2733
<div class="right figure" id="figure-movies/chapter-06/SDF-triangle.mp4" style="width: 25%">
2735
- <video autoplay="True" controls="True" loop="True">
2734
+ <video controls="True" loop="True">
2736
2735
<source src="movies/chapter-06/SDF-triangle.mp4"></source>
2737
2736
</video>
2738
2737
<p class="caption">Figure</p>
@@ -2772,7 +2771,7 @@ <h4>True triangle</h4>
2772
2771
<div class="section" id="round-triangle">
2773
2772
<h4>Round triangle</h4>
2774
2773
<div class="right figure" id="figure-movies/chapter-06/SDF-round-triangle.mp4" style="width: 25%">
2775
- <video autoplay="True" controls="True" loop="True">
2774
+ <video controls="True" loop="True">
2776
2775
<source src="movies/chapter-06/SDF-round-triangle.mp4"></source>
2777
2776
</video>
2778
2777
<p class="caption">Figure</p>
@@ -2794,7 +2793,7 @@ <h4>Round triangle</h4>
2794
2793
<div class="section" id="fake-triangle">
2795
2794
<h4>Fake triangle</h4>
2796
2795
<div class="right figure" id="figure-movies/chapter-06/SDF-fake-triangle.mp4" style="width: 25%">
2797
- <video autoplay="True" controls="True" loop="True">
2796
+ <video controls="True" loop="True">
2798
2797
<source src="movies/chapter-06/SDF-fake-triangle.mp4"></source>
2799
2798
</video>
2800
2799
<p class="caption">Figure</p>
@@ -2827,7 +2826,7 @@ <h4>Fake triangle</h4>
2827
2826
<div class="section" id="true-ellipse">
2828
2827
<h4>True ellipse</h4>
2829
2828
<div class="right figure" id="figure-movies/chapter-06/SDF-ellipse.mp4" style="width: 25%">
2830
- <video autoplay="True" controls="True" loop="True">
2829
+ <video controls="True" loop="True">
2831
2830
<source src="movies/chapter-06/SDF-ellipse.mp4"></source>
2832
2831
</video>
2833
2832
<p class="caption">Figure</p>
@@ -2887,7 +2886,7 @@ <h4>True ellipse</h4>
2887
2886
<div class="section" id="fake-but-fast-ellipse">
2888
2887
<h4>Fake (but fast) ellipse</h4>
2889
2888
<div class="right figure" id="figure-movies/chapter-06/SDF-fake-ellipse.mp4" style="width: 25%">
2890
- <video autoplay="True" controls="True" loop="True">
2889
+ <video controls="True" loop="True">
2891
2890
<source src="movies/chapter-06/SDF-fake-ellipse.mp4"></source>
2892
2891
</video>
2893
2892
<p class="caption">Figure</p>
@@ -3142,7 +3141,7 @@ <h3><a class="toc-backref" href="#id27">Antialiased points</a></h3>
3142
3141
<div class="section" id="ellipses">
3143
3142
<h2><a class="toc-backref" href="#id27">Ellipses</a></h2>
3144
3143
<div class="right figure" id="figure-movies/chapter-07/ellipses.mp4" style="width: 30%">
3145
- <video autoplay="True" controls="True" loop="True">
3144
+ <video controls="True" loop="True">
3146
3145
<source src="movies/chapter-07/ellipses.mp4"></source>
3147
3146
</video>
3148
3147
<p class="caption">Figure</p>
@@ -3350,7 +3349,7 @@ <h3><a class="toc-backref" href="#id27">Tiny discs</a></h3>
3350
3349
<div class="section" id="antialiased-triangles">
3351
3350
<h3><a class="toc-backref" href="#id27">Antialiased triangles</a></h3>
3352
3351
<div class="right figure" id="figure-movies/chapter-07/triangles.mp4" style="width: 30%">
3353
- <video autoplay="True" controls="True" loop="True">
3352
+ <video controls="True" loop="True">
3354
3353
<source src="movies/chapter-07/triangles.mp4"></source>
3355
3354
</video>
3356
3355
<p class="caption">Figure</p>
@@ -3776,7 +3775,7 @@ <h2><a class="toc-backref" href="#id29">Texture based</a></h2>
3776
3775
to say that the precision of the distance is directly correlated with the size
3777
3776
of your texture...</p>
3778
3777
<div class="right figure" id="figure-movies/chapter-08/texture-marker.mp4" style="width: 30%">
3779
- <video autoplay="True" controls="True" loop="True">
3778
+ <video controls="True" loop="True">
3780
3779
<source src="movies/chapter-08/texture-marker.mp4"></source>
3781
3780
</video>
3782
3781
<p class="caption">Figure</p>
@@ -3824,7 +3823,7 @@ <h3><a class="toc-backref" href="#id29">Quiver plot</a></h3>
3824
3823
<div class="section" id="light-and-shadows">
3825
3824
<h3><a class="toc-backref" href="#id29">Light and shadows</a></h3>
3826
3825
<div class="right figure" id="figure-movies/chapter-08/SDF-light-shadow.mp4" style="width: 50%">
3827
- <video autoplay="True" controls="True" loop="True">
3826
+ <video controls="True" loop="True">
3828
3827
<source src="movies/chapter-08/SDF-light-shadow.mp4"></source>
3829
3828
</video>
3830
3829
<p class="caption">Figure</p>
@@ -4220,7 +4219,7 @@ <h3><a class="toc-backref" href="#id39">Broken lines</a></h3>
4220
4219
if a given fragment is inside the joint area or not. This requires a specific
4221
4220
parameterization that relies on having a different tesselation with 4×n
4222
4221
vertices instead of 2×n. I won't explain all the details here but only provide
4223
- the final result that you can found in <a class="reference external" href="code/chapter-09/geom.path .py">geom-path.py</a>.</p>
4222
+ the final result that you can found in <a class="reference external" href="code/chapter-09/geom_path .py">geom-path.py</a>.</p>
4224
4223
<p>If you look at the sources, you'll see I'm using a geometry shader, which is a
4225
4224
new type of shader that is not officially available in GL ES 2.0 but which is
4226
4225
nonetheless available on a wide number of implementations. This geometry shader
@@ -4252,7 +4251,7 @@ <h3><a class="toc-backref" href="#id39">Broken lines</a></h3>
4252
4251
<p class="caption">Figure</p>
4253
4252
<div class="legend">
4254
4253
Different line joints using a geometry shader. See
4255
- <a class="reference external" href="code/chapter-09/geom.path .py">geom-path.py</a>.</div>
4254
+ <a class="reference external" href="code/chapter-09/geom_path .py">geom-path.py</a>.</div>
4256
4255
</div>
4257
4256
</div>
4258
4257
<div class="section" id="bezier-curves">
@@ -4316,7 +4315,7 @@ <h2><a class="toc-backref" href="#id39">Patterns</a></h2>
4316
4315
<div class="section" id="simple-dotted-pattern">
4317
4316
<h3><a class="toc-backref" href="#id39">Simple dotted pattern</a></h3>
4318
4317
<div class="right figure" id="figure-movies/chapter-09/linestrip-dotted.mp4" style="width: 35%">
4319
- <video autoplay="True" controls="True" loop="True">
4318
+ <video controls="True" loop="True">
4320
4319
<source src="movies/chapter-09/linestrip-dotted.mp4"></source>
4321
4320
</video>
4322
4321
<p class="caption">Figure</p>
@@ -4361,7 +4360,7 @@ <h3><a class="toc-backref" href="#id39">Simple dotted pattern</a></h3>
4361
4360
<span class="punctuation">...</span>
4362
4361
</pre>
4363
4362
<div class="right figure" id="figure-movies/chapter-09/linestrip-spaded.mp4" style="width: 35%">
4364
- <video autoplay="True" controls="True" loop="True">
4363
+ <video controls="True" loop="True">
4365
4364
<source src="movies/chapter-09/linestrip-spaded.mp4"></source>
4366
4365
</video>
4367
4366
<p class="caption">Figure</p>
@@ -4387,19 +4386,19 @@ <h3><a class="toc-backref" href="#id39">Arbitrary dash patterns</a></h3>
4387
4386
<a class="reference external" href="http://jcgt.org/published/0002/02/08/code.zip">Python implementation</a>. The
4388
4387
result is illustrated on the movies below.</p>
4389
4388
<div class="left figure" id="figure-movies/chapter-09/stars.mp4" style="width: 30%">
4390
- <video autoplay="True" controls="True" loop="True">
4389
+ <video controls="True" loop="True">
4391
4390
<source src="movies/chapter-09/stars.mp4"></source>
4392
4391
</video>
4393
4392
<p class="caption">Figure</p>
4394
4393
</div>
4395
4394
<div class="left figure" id="figure-movies/chapter-09/sphere.mp4" style="width: 30%">
4396
- <video autoplay="True" controls="True" loop="True">
4395
+ <video controls="True" loop="True">
4397
4396
<source src="movies/chapter-09/sphere.mp4"></source>
4398
4397
</video>
4399
4398
<p class="caption">Figure</p>
4400
4399
</div>
4401
4400
<div class="left figure" id="figure-movies/chapter-09/tiger.mp4" style="width: 30%">
4402
- <video autoplay="True" controls="True" loop="True">
4401
+ <video controls="True" loop="True">
4403
4402
<source src="movies/chapter-09/tiger.mp4"></source>
4404
4403
</video>
4405
4404
<p class="caption">Figure</p>
@@ -4412,7 +4411,7 @@ <h3><a class="toc-backref" href="#id39">Arbitrary dash patterns</a></h3>
4412
4411
<div class="section" id="d-lines">
4413
4412
<h2><a class="toc-backref" href="#id39">3D lines</a></h2>
4414
4413
<div class="right figure" id="figure-movies/chapter-09/linestrip-3d.mp4" style="width: 35%">
4415
- <video autoplay="True" controls="True" loop="True">
4414
+ <video controls="True" loop="True">
4416
4415
<source src="movies/chapter-09/linestrip-3d.mp4"></source>
4417
4416
</video>
4418
4417
<p class="caption">Figure</p>
@@ -4491,7 +4490,7 @@ <h3><a class="toc-backref" href="#id39">Fixed apparent thickness</a></h3>
4491
4490
<div class="section" id="varying-apparent-thickness">
4492
4491
<h3><a class="toc-backref" href="#id39">Varying apparent thickness</a></h3>
4493
4492
<div class="right figure" id="figure-movies/chapter-09/linestrip-3d-better.mp4" style="width: 35%">
4494
- <video autoplay="True" controls="True" loop="True">
4493
+ <video controls="True" loop="True">
4495
4494
<source src="movies/chapter-09/linestrip-3d-better.mp4"></source>
4496
4495
</video>
4497
4496
<p class="caption">Figure</p>
@@ -4962,7 +4961,6 @@ <h1><a class="toc-backref" href="#contents">Rendering a mesh</a></h1>
4962
4961
.. figure:: movies/chapter-11/boy.mp4
4963
4962
:figclass: right
4964
4963
:loop:
4965
- :autoplay:
4966
4964
:controls:
4967
4965
:figwidth: 35%
4968
4966
@@ -5069,7 +5067,6 @@ <h1><a class="toc-backref" href="#contents">Special techniques</a></h1>
5069
5067
5070
5068
.. figure:: data/quad-grid.mp4
5071
5069
:loop:
5072
- :autoplay:
5073
5070
:controls:
5074
5071
:figwidth: 35%
5075
5072
:figclass: left
0 commit comments