Skip to content

Commit 941c366

Browse files
committed
Relocation part III
1 parent e251353 commit 941c366

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+410
-408
lines changed

02-introduction.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ Bindings
376376
* Ctypes_ bindings can also be generated quite easily thanks to the gl.xml_
377377
file provided by the Khronos group that defines the OpenGL and OpenGL API
378378
Registry. The number of functions and constants given in the table above have
379-
been computed using the `<code/registry.py>`_ program that parses the gl.xml
380-
file for each API and version and count the relevant features.
379+
been computed using the `<code/chapter-02/registry.py>`_ program that parses
380+
the gl.xml file for each API and version and count the relevant features.
381381

382382

383383
Engines

03-quickstart.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Quickstart
88

99

1010
For the **really** impatient, you can try to run the code in the `teaser image
11-
<code/glumpy-quad-solid.py>`_ above. If this works, a window should open on your
12-
desktop with a red color in the background. If you now want to understand how
13-
this works, you'll have to read the text below.
11+
<code/chapter-03/glumpy-quad-solid.py>`_ above. If this works, a window should
12+
open on your desktop with a red color in the background. If you now want to
13+
understand how this works, you'll have to read the text below.
1414

1515

1616
Preliminaries
@@ -688,7 +688,7 @@ shader program, using the proper mode.
688688
# Run the app
689689
app.run()
690690
691-
The whole source is available in `<code/glumpy-quad-solid.py>`_.
691+
The whole source is available in `<code/chapter-03/glumpy-quad-solid.py>`_.
692692

693693
If you run this program using the `--debug` switch, you should obtain the
694694
following output that show what is being done in the background. More
@@ -728,7 +728,7 @@ Uniform color
728728

729729
Adding a `uniform` specified color like is only a matter of modifying the
730730
fragment shader as in the previous section an directly assigning the color to
731-
the quad program (see `<code/glumpy-quad-uniform-color.py>`_):
731+
the quad program (see `<code/chapter-03/glumpy-quad-uniform-color.py>`_):
732732

733733
.. code:: python
734734
@@ -741,7 +741,7 @@ Varying color
741741

742742
Adding a per-vertex color like is also and only a matter of modifying the
743743
fragment shader as in the previous section an directly assigning the color to
744-
the quad program (see `<code/glumpy-quad-varying-color.py>`_):
744+
the quad program (see `<code/chapter-03/glumpy-quad-varying-color.py>`_):
745745

746746
.. code:: python
747747
@@ -822,10 +822,10 @@ tricks in the next chapters.
822822

823823
Basic animation with the quad.
824824

825-
**Scaling the quad** We've been using previously a `uniform` to pass a
826-
color to the fragment shader, but we could have used also in the vertex shader
827-
to pass any kind of information. In this exercise, try to modify the vertex
828-
shader in the `varying color example <code/glumpy-quad-varying-color.py>`_ in
825+
**Scaling the quad** We've been using previously a `uniform` to pass a color to
826+
the fragment shader, but we could have used also in the vertex shader to pass
827+
any kind of information. In this exercise, try to modify the vertex shader in
828+
the `varying color example <code/chapter-03/glumpy-quad-varying-color.py>`_ in
829829
order for the quad to be animated and to scale with time as shown in the figure
830830
on the right. You will need to update the scale factor within the Python
831831
program, for example in the `draw` function.
@@ -856,7 +856,7 @@ angle theta around the origin (0,0) for a point (x,y):
856856
float y2 = sin(theta)*x + cos(theta)*y;
857857
858858
859-
Solution: `<code/quad-rotate.py>`_
859+
Solution: `<code/chapter-03/quad-rotate.py>`_
860860

861861

862862
.. _GLUT: http://freeglut.sourceforge.net

04-maths.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ within the volume (even partially) will be rendered while objects outside
380380
won't. On the image below, the yellow and red spheres are within the volume
381381
while the green one is not and does not appear on the projection.
382382

383-
.. image:: data/projection.png
383+
.. image:: images/chapter-04/projection.png
384384
:width: 100%
385385

386386
There exist many different ways to project a 3D volume onto a 2D screen but

05-cube.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ matrices as well as rotation, translation and scaling operations). This default
109109
perspective matrix is located at the origin and look in the negative z
110110
direction with the up direction pointing toward the positive y-axis. If we
111111
leave our cube at the origin, the camera would be inside the cube and we woudl
112-
not see much. So let first crate a view matrix that is a translation along the
112+
not see much. So let first create a view matrix that is a translation along the
113113
z-axis:
114114

115115
.. code:: python

06-anti-grain.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ vertices defining the box.
412412
Rounded Box
413413
~~~~~~~~~~~
414414

415-
.. figure:: data/SDF-round-box.mp4
415+
.. figure:: movies/chapter-06/SDF-round-box.mp4
416416
:loop:
417417
:autoplay:
418418
:controls:

07-points.rst

+21-20
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Note that there is a new `gl_FragCoord` variable in this fragment shader. This
6767
variable gives the coordinate of the current fragment in window coordinates
6868
(bottom-left is (0,0)). Without it, the `gl.GL_POINTS` would be useless.
6969

70-
Last, we setup our python program (see `dots-1.py <code/dots-1.py>`_).
70+
Last, we setup our python program (see `dots-1.py <code/chapter-07/dots-1.py>`_).
7171

7272
.. code:: python
7373
@@ -93,15 +93,16 @@ Last, we setup our python program (see `dots-1.py <code/dots-1.py>`_).
9393
app.run()
9494
9595
96-
.. figure:: data/dots-1.png
96+
.. figure:: images/chapter-07/dots-1.png
9797
:figwidth: 50%
9898
:figclass: right
9999

100100
Figure
101101

102102
Discs positionned vertically with a 0.2 pixel increase.
103+
See `code/chapter-07/discs-aligned.py`_
103104

104-
.. figure:: data/dots-2.png
105+
.. figure:: images/chapter-07/dots-2.png
105106
:figwidth: 50%
106107
:figclass: right
107108

@@ -117,7 +118,7 @@ pixels compared to its left neightbour. However, you cannot see any artefacts
117118

118119
----
119120

120-
.. figure:: data/triangles.mp4
121+
.. figure:: movies/chapter-07/triangles.mp4
121122
:loop:
122123
:autoplay:
123124
:controls:
@@ -126,7 +127,7 @@ pixels compared to its left neightbour. However, you cannot see any artefacts
126127

127128
Figure
128129

129-
.. figure:: data/ellipses.mp4
130+
.. figure:: movies/chapter-07/ellipses.mp4
130131
:loop:
131132
:autoplay:
132133
:controls:
@@ -135,7 +136,7 @@ pixels compared to its left neightbour. However, you cannot see any artefacts
135136

136137
Figure
137138

138-
.. figure:: data/spiral.png
139+
.. figure:: images/chapter-07/spiral.png
139140
:figwidth: 30%
140141
:figclass: right
141142

@@ -147,7 +148,7 @@ Markers
147148
-------------------------------------------------------------------------------
148149

149150

150-
.. figure:: data/CSG-markers.png
151+
.. figure:: images/chapter-07/CSG-markers.png
151152
:figwidth: 50%
152153
:figclass: right
153154

@@ -168,7 +169,7 @@ Constructive Solid Geometry
168169
-------------------------------------------------------------------------------
169170

170171

171-
.. figure:: data/CSG.png
172+
.. figure:: images/chapter-07/CSG.png
172173
:figwidth: 50%
173174
:figclass: right
174175

@@ -216,72 +217,72 @@ And we can check for the result using two circles (the shadertoy link for each
216217
example allows you to play online with them):
217218

218219

219-
.. figure:: data/CSG-intersection.png
220+
.. figure:: images/chapter-07/CSG-intersection.png
220221
:figwidth: 30%
221222
:figclass: right
222223

223224
Figure
224225

225226
| Intersection (A and B)
226-
| `CSG-intersection.py <code/csg-intersection.py>`_ / `Shadertoy`__
227+
| `CSG-intersection.py <code/chapter-07/csg-intersection.py>`_ / `Shadertoy`__
227228
228229
__ https://www.shadertoy.com/view/XllyWn
229230

230-
.. figure:: data/CSG-union.png
231+
.. figure:: images/chapter-07/CSG-union.png
231232
:figwidth: 30%
232233
:figclass: right
233234

234235
Figure
235236

236237
| Union (A or B)
237-
| `CSG-union.py <code/csg-union.py>`_ / `Shadertoy`__
238+
| `CSG-union.py <code/chapter-07/csg-union.py>`_ / `Shadertoy`__
238239
239240
__ https://www.shadertoy.com/view/4tlyWn
240241

241-
.. figure:: data/CSG-mix.png
242+
.. figure:: images/chapter-07/CSG-mix.png
242243
:figwidth: 30%
243244
:figclass: right
244245

245246
Figure
246247

247248
| Two SDF circles (A, B)
248-
| `CSG-mix.py <code/csg-mix.py>`_ / `Shadertoy`__
249+
| `CSG-mix.py <code/chapter-07/csg-mix.py>`_ / `Shadertoy`__
249250
250251
__ https://www.shadertoy.com/view/MtfcDr
251252

252253
----
253254

254-
.. figure:: data/CSG-exclusion.png
255+
.. figure:: images/chapter-07/CSG-exclusion.png
255256
:figwidth: 30%
256257
:figclass: right
257258

258259
Figure
259260

260261
| Exclusion (A xor B)
261-
| `CSG-exclusion.py <code/csg-exclusion.py>`_ / `Shadertoy`__
262+
| `CSG-exclusion.py <code/chapter-07/csg-exclusion.py>`_ / `Shadertoy`__
262263
263264
__ https://www.shadertoy.com/view/4tsyWn
264265

265266

266-
.. figure:: data/CSG-difference-2.png
267+
.. figure:: images/chapter-07/CSG-difference-2.png
267268
:figwidth: 30%
268269
:figclass: right
269270

270271
Figure
271272

272273
| Difference (A not B)
273-
| `CSG-difference-2.py <code/csg-difference-2.py>`_ / `Shadertoy`__
274+
| `CSG-difference-2.py <code/chapter-07/csg-difference-2.py>`_ / `Shadertoy`__
274275
275276
__ https://www.shadertoy.com/view/XtsyWn
276277

277-
.. figure:: data/CSG-difference-1.png
278+
.. figure:: images/chapter-07/CSG-difference-1.png
278279
:figwidth: 30%
279280
:figclass: right
280281

281282
Figure
282283

283284
| Difference (B not A)
284-
| `CSG-difference-1.py <code/csg-difference-1.py>`_ / `Shadertoy`__
285+
| `CSG-difference-1.py <code/chapter-07/csg-difference-1.py>`_ / `Shadertoy`__
285286
286287
__ https://www.shadertoy.com/view/4llyWn
287288

08-lines.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Rendering lines
99
Segments
1010
--------
1111

12-
.. figure:: data/segment.png
12+
.. figure:: images/chapter-08/segment.png
1313
:figwidth: 50%
1414

1515
Figure

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Python & OpenGL for Scientific Visualization
22
============================================
33

4-
| Copyright (c) 2017 Nicolas P. Rougier
4+
| Copyright (c) 2018 Nicolas P. Rougier
55
| **License**: Creative Commons Attribution 4.0 International (CC BY-NC-SA 4.0)
66
| **Website**: http://www.labri.fr/perso/nrougier/python+opengl
77
|
@@ -22,7 +22,7 @@ arbitrary transformations but there are actually many more techniques to be
2222
discovered and explained in this open-access book. And of course, everything
2323
will be fast and beautiful.
2424

25-
.. image:: data/polar-projection.png
25+
.. image:: images/teaser.png
2626

2727
This book is open-access (i.e. it's free to read at `this address
2828
<http://www.labri.fr/perso/nrougier/python+opengl>`_) because I believe

book.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ body {
9292
}
9393

9494
/* Buy the book !!! */
95-
#id53 {
95+
#id54 {
9696
padding-top: .25em;
9797
padding-bottom: .25em;
9898
color: #ffffff;

0 commit comments

Comments
 (0)