Skip to content

Commit 1b3b5ce

Browse files
Updated the README and the examples for the pyglet dependency removal
1 parent 60350a2 commit 1b3b5ce

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ PyWavefront
33

44
This python module allows you to read Wavefront 3D object files
55
(`something.obj` and `something.mtl`) and use them as Python objects.
6-
Currently Pyglet is required to render and display these objects.
6+
If you optionally want to render and display these objects, Pyglet is required.
77

88
Currently, only a subset of [the defined
99
specification](https://en.wikipedia.org/wiki/Wavefront_.obj_file) has
1010
been implemented.
1111

12-
Requirements
12+
Optional Dependencies
1313
------------
1414

1515
* [Pyglet](http://www.pyglet.org/)
@@ -19,14 +19,29 @@ Usage
1919

2020
### From Python
2121

22-
import pywavefront
23-
meshes = pywavefront.Wavefront('something.obj')
24-
meshes.draw()
22+
**Basic**
23+
24+
```python
25+
import pywavefront
26+
meshes = pywavefront.Wavefront('something.obj')
27+
```
28+
29+
**Visualization**
30+
31+
```python
32+
import pywavefront
33+
34+
[create a window and set up your OpenGl context]
35+
meshes = pywavefront.Wavefront('something.obj')
36+
37+
[inside your drawing loop]
38+
meshes.draw()
39+
```
2540

2641
### Example Script
2742

2843
There are two pyglet example scripts with included `.obj` and `.mtl` files in the `example` directory. To run them, change to the `example`
29-
directory and run either `./pyglet_demo.py` or `.pyglet_demo2.py`.
44+
directory and run either `./pyglet_demo.py` or `.pyglet_demo2.py`. Pyglet is required for these.
3045

3146
### Generating a Wavefront file with Blender
3247

example/pyglet_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pyglet
88
from pyglet.gl import *
99

10-
import pywavefront
10+
import pywavefront.visualization
1111

1212
rotation = 0
1313

example/pyglet_demo2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pyglet.gl import *
1010

1111
from pywavefront import Wavefront
12+
import pywavefront.visualization
1213

1314
rotation = 0
1415

0 commit comments

Comments
 (0)