33demosys-py
44==========
55
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
77prototype demos (see
88`demoscene <https://en.wikipedia.org/wiki/Demoscene >`__) in OpenGL. The
99design of this version is heavily inspired by the
@@ -15,15 +15,12 @@ design of this version is heavily inspired by the
1515
1616We only support OpenGL 4.1+ core profiles (no backwards compatibility).
1717
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-
2118This was originally made for for non-interactive real time graphics
2219combined with music ("real time music videos"). It's made for people who
2320enjoy playing around with modern OpenGL without having to spend lots of
2421time creating all the tooling to get things up and running.
2522
26- Demosys is now on PyPI
23+ demosys-py is now on PyPI
2724
2825::
2926
@@ -43,8 +40,9 @@ features or documentation or suggest new entires.
4340Running the damned thing
4441------------------------
4542
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
4744- 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
4846- Make a virtualenv and install the package: ``pip install demosys-py ``.
4947- Run the default test effect: ``demosys_test runeffect demosys_test.cube ``
5048
@@ -53,25 +51,17 @@ Running from source
5351-------------------
5452
5553Again, make sure you have python 3.6 or later before proceeding.
54+ Let's clone the testdemo project.
5655
5756::
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
7159 python3 -m virtualenv env
7260 source env/bin/activate
7361 pip install -r requirements.txt
62+ ./manage.py runeffect testdemo.cube
7463
64+ This runs the effect ``cube `` in the ``testdemo `` package.
7565
7666Controls
7767========
@@ -86,14 +76,21 @@ Controls
8676I just want to see an example!
8777==============================
8878
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.
9082
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.
9390
9491::
9592
96- demosys_test
93+ testdemo
9794 ├── cube
9895 │ ├── effect.py
9996 │ ├── shaders
@@ -103,7 +100,7 @@ effects with the same structure inside ``demosys_test``
103100 │ └── cube
104101 │ └── texture.png
105102
106- effect.py
103+ The effect.py generated looks something like this:
107104
108105.. code :: python
109106
@@ -138,15 +135,15 @@ effect.py
138135
139136 There you go.
140137
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 `` .
143140- The ``cube `` objects is a ``VAO `` that you bind supplying the shader and the system
144141 will figure out the attribute mapping.
145142- 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 _ .
147144- You currently define vertex,
148145 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.
150147
151148That should give you an idea..
152149
@@ -158,9 +155,9 @@ that effect is one or multiple things is entirely up to you. An effect
158155is an individual package/directory containing an ``effect.py `` module.
159156This package can also contain a ``shaders `` and ``textures `` directory
160157that demosys will automatically find and load resources from. See the
161- `` demosys_test `` directory for reference .
158+ testdemo _ .
162159
163- Explore the small `` demosys_test `` folder , and you'll get the point.
160+ Explore the testdemo _ project , and you'll get the point.
164161
165162Some babble about the current state of the project:
166163
@@ -170,7 +167,7 @@ Some babble about the current state of the project:
170167- We support vertex,
171168 fragment and geometry shaders for now. A program must currently be
172169 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 _ .
174171- The Shader class will inspect the linked shader and cache all attributes
175172 and uniforms in local dictionaries. This means all ``uniform* ``-setters use
176173 the name of the uniform instead of the location. Location is resolved
@@ -249,6 +246,17 @@ tried mp3 files!)
249246 PROJECT_DIR = os.path.dirname(os.path.abspath(__file__ ))
250247 MUSIC = os.path.join(PROJECT_DIR , ' resources/music/tg2035.mp3' )
251248
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+
252260EFFECTS
253261~~~~~~~
254262
@@ -338,7 +346,7 @@ Use version 3.2.1 or later.
338346Credits
339347-------
340348
341- - Music in `` demosys_test `` by `binaryf <https://github.com/binaryf >`__
349+ - Music in testdemo _ by `binaryf <https://github.com/binaryf >`__
342350- Also thanks to `Attila
343351 Toth <https://www.youtube.com/channel/UC4L3JyeL7TXQM1f3yD6iVQQ> `__
344352 for an excellent tutorial on OpenGL in Python. We do know OpenGL, but
@@ -354,9 +362,11 @@ What inspired us to make this project?
354362Why not combine ideas from our own demosys written in C++ and Django
355363making a Python 3 version?
356364
365+ .. _testdemo : https://github.com/Contraz/demosys-py-test
357366.. |pypi | image :: https://img.shields.io/pypi/v/demosys-py.svg
358367 :target: https://pypi.python.org/pypi/demosys-py
359368.. |travis | image :: https://travis-ci.org/Contraz/demosys-py.svg?branch=master
360369 :target: https://travis-ci.org/Contraz/demosys-py
361370.. |screenshot1 | image :: https://objects.zetta.io:8443/v1/AUTH_06e2dbea5e824620b20b470197323277/contraz.no-static/gfx/productions/SimLife3.png
362371.. |screenshot2 | image :: https://objects.zetta.io:8443/v1/AUTH_06e2dbea5e824620b20b470197323277/contraz.no-static/gfx/productions/SimLife2.png
372+
0 commit comments