3
3
demosys-py
4
4
==========
5
5
6
- A python 3.6 implementation of a C++ project used to create and
6
+ A python 3 implementation of a C++ project used to create and
7
7
prototype demos (see
8
8
`demoscene <https://en.wikipedia.org/wiki/Demoscene >`__) in OpenGL. The
9
9
design of this version is heavily inspired by the
@@ -15,15 +15,12 @@ design of this version is heavily inspired by the
15
15
16
16
We only support OpenGL 4.1+ core profiles (no backwards compatibility).
17
17
18
- **Also note that Python 3.6 will and is the minimum requirement for
19
- reasons we won't dig deeper into right now **
20
-
21
18
This was originally made for for non-interactive real time graphics
22
19
combined with music ("real time music videos"). It's made for people who
23
20
enjoy playing around with modern OpenGL without having to spend lots of
24
21
time creating all the tooling to get things up and running.
25
22
26
- Demosys is now on PyPI
23
+ demosys-py is now on PyPI
27
24
28
25
::
29
26
@@ -43,8 +40,9 @@ features or documentation or suggest new entires.
43
40
Running the damned thing
44
41
------------------------
45
42
46
- - First og all install the latest python 3.6 package (or later) from python.org
43
+ - First of all install the latest python 3.6 package (or later) from python.org
47
44
- Install GLFW binaries for your OS from your favorite package manger or download it from http://www.glfw.org/
45
+ - If you want working music you will also need to install SDL
48
46
- Make a virtualenv and install the package: ``pip install demosys-py ``.
49
47
- Run the default test effect: ``demosys_test runeffect demosys_test.cube ``
50
48
@@ -53,25 +51,17 @@ Running from source
53
51
-------------------
54
52
55
53
Again, make sure you have python 3.6 or later before proceeding.
54
+ Let's clone the testdemo project.
56
55
57
56
::
58
-
59
- ./manage.py runeffect demosys_test.cube
60
-
61
- This runs the effect ``cube `` in the ``demosys_test `` package in the
62
- repository. You can of course also make your own.
63
-
64
- Manual setup (OS X / Linux):
65
-
66
- .. code :: python
67
-
68
- git clone https:// github.com/ Contraz/ demosys- py
69
- cd demosys- py
70
- python3 - m pip install virtualenv
57
+ git clone https://github.com/Contraz/demosys-py-test
58
+ cd demosys-py-test
71
59
python3 -m virtualenv env
72
60
source env/bin/activate
73
61
pip install -r requirements.txt
62
+ ./manage.py runeffect testdemo.cube
74
63
64
+ This runs the effect ``cube `` in the ``testdemo `` package.
75
65
76
66
Controls
77
67
========
@@ -86,14 +76,21 @@ Controls
86
76
I just want to see an example!
87
77
==============================
88
78
89
- Ok, ok! Let's make a project and an effect-package!
79
+ Ok, ok! You can find examples in the testdemo _.
80
+
81
+ To create a project with an effect we can use the convenient demosys-admin command.
90
82
91
- Structure of a project. ``cube `` is an effect. You can make multiple
92
- effects with the same structure inside ``demosys_test ``
83
+ .. code :: shell
84
+
85
+ demosys-admin createproject testdemo
86
+ cd testdemo
87
+ demosys-admin createeffect cube
88
+
89
+ We should now have the following stucture with a working effect we can actually run.
93
90
94
91
::
95
92
96
- demosys_test
93
+ testdemo
97
94
├── cube
98
95
│ ├── effect.py
99
96
│ ├── shaders
@@ -103,7 +100,7 @@ effects with the same structure inside ``demosys_test``
103
100
│ └── cube
104
101
│ └── texture.png
105
102
106
- effect.py
103
+ The effect.py generated looks something like this:
107
104
108
105
.. code :: python
109
106
@@ -138,15 +135,15 @@ effect.py
138
135
139
136
There you go.
140
137
141
- - Since you asked for `` cube.glsl `` and `` texture.png `` these will be
142
- automatically be loaded ready to use .
138
+ - Shaders and textures can be easily loaded by using the `` get_texture `` and
139
+ `` get_shader `` method inherited from `` Effect `` .
143
140
- The ``cube `` objects is a ``VAO `` that you bind supplying the shader and the system
144
141
will figure out the attribute mapping.
145
142
- Please look in the ``demosys.opengl.geometry `` module for the valid attribute names and
146
- look at shaders in the `` demosys_test `` .
143
+ look at shaders in the testdemo _ .
147
144
- You currently define vertex,
148
145
fragment and geometry shader in one glsl file separated by
149
- preprocessors. - Effects not defined in the ``settings `` module will not run!
146
+ preprocessors. - Effects not defined in the ``settings.py `` module will not run.
150
147
151
148
That should give you an idea..
152
149
@@ -158,9 +155,9 @@ that effect is one or multiple things is entirely up to you. An effect
158
155
is an individual package/directory containing an ``effect.py `` module.
159
156
This package can also contain a ``shaders `` and ``textures `` directory
160
157
that demosys will automatically find and load resources from. See the
161
- `` demosys_test `` directory for reference .
158
+ testdemo _ .
162
159
163
- Explore the small `` demosys_test `` folder , and you'll get the point.
160
+ Explore the testdemo _ project , and you'll get the point.
164
161
165
162
Some babble about the current state of the project:
166
163
@@ -170,7 +167,7 @@ Some babble about the current state of the project:
170
167
- We support vertex,
171
168
fragment and geometry shaders for now. A program must currently be
172
169
written in one single ``.glsl `` file separating the shaders with
173
- preprocessors. See existing shaders in `` demosys_test `` .
170
+ preprocessors. See existing shaders in testdemo _ .
174
171
- The Shader class will inspect the linked shader and cache all attributes
175
172
and uniforms in local dictionaries. This means all ``uniform* ``-setters use
176
173
the name of the uniform instead of the location. Location is resolved
@@ -249,6 +246,17 @@ tried mp3 files!)
249
246
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__ ))
250
247
MUSIC = os.path.join(PROJECT_DIR , ' resources/music/tg2035.mp3' )
251
248
249
+ TIMER
250
+ ~~~~~
251
+
252
+ This is the timer class that controls time in your project.
253
+ This defaults to ``demosys.timers.Timer `` that is simply keeps
254
+ track of system time using ``glfw ``.
255
+
256
+ ```demosys.timers.MusicTimer` `` requires ``MUSIC `` to be defined
257
+ and will use the current time in the mp3.
258
+
259
+
252
260
EFFECTS
253
261
~~~~~~~
254
262
@@ -338,7 +346,7 @@ Use version 3.2.1 or later.
338
346
Credits
339
347
-------
340
348
341
- - Music in `` demosys_test `` by `binaryf <https://github.com/binaryf >`__
349
+ - Music in testdemo _ by `binaryf <https://github.com/binaryf >`__
342
350
- Also thanks to `Attila
343
351
Toth <https://www.youtube.com/channel/UC4L3JyeL7TXQM1f3yD6iVQQ> `__
344
352
for an excellent tutorial on OpenGL in Python. We do know OpenGL, but
@@ -354,9 +362,11 @@ What inspired us to make this project?
354
362
Why not combine ideas from our own demosys written in C++ and Django
355
363
making a Python 3 version?
356
364
365
+ .. _testdemo : https://github.com/Contraz/demosys-py-test
357
366
.. |pypi | image :: https://img.shields.io/pypi/v/demosys-py.svg
358
367
:target: https://pypi.python.org/pypi/demosys-py
359
368
.. |travis | image :: https://travis-ci.org/Contraz/demosys-py.svg?branch=master
360
369
:target: https://travis-ci.org/Contraz/demosys-py
361
370
.. |screenshot1 | image :: https://objects.zetta.io:8443/v1/AUTH_06e2dbea5e824620b20b470197323277/contraz.no-static/gfx/productions/SimLife3.png
362
371
.. |screenshot2 | image :: https://objects.zetta.io:8443/v1/AUTH_06e2dbea5e824620b20b470197323277/contraz.no-static/gfx/productions/SimLife2.png
372
+
0 commit comments