A simple shader package for Pyglet.
Project description
Shaderpy
A small shader package for Pyglet.
Documentation
Creating a shader:
shader = shader.Shader(
[
('shaders/color.vs', GL_VERTEX_SHADER),
('shaders/color.fs', GL_FRAGMENT_SHADER)
])
Binding and unbinding a shader:
shader.bind()
# Render awesome stuff
shader.unbind()
Example of different ways of setting uniforms:
matrix = [1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0]
matrix2 = numpy.array(matrix)
matrix3 = numpy.matrix(matrix)
shader.set_uniform('MyFloat', 42.0)
shader.set_uniform('MyVector', 1.0, 0.0)
shader.set_uniform('MySecondVector', [1.0, 2.0, 3.0])
shader.set_uniform_matrix('MyMatrix', matrix)
shader.set_uniform_matrix('MySecondMatrix', matrix2)
shader.set_uniform_matrix('MyThirdMatrix', matrix3)
Deleting a shader:
shader.delete()
Installation
pip install shaderpy
```Change Log
============
0.0.1 (2021-02-27)
-------------------
- First Release
0.0.2 (2021-02-27)
-------------------
- Added error handling when compiling shaders and linking programs.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shaderpy-0.0.2.tar.gz
(3.9 kB
view details)
File details
Details for the file shaderpy-0.0.2.tar.gz.
File metadata
- Download URL: shaderpy-0.0.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd2a9f73dee7434e8ef4c98e37061a331391bd314cc47d037ac7e648fe6270f
|
|
| MD5 |
a70afb58c6c1de7c99829839c97b03c7
|
|
| BLAKE2b-256 |
cf52579b57b558f2aa11127f754d5a394badd27ffbe72acaef638758b4897533
|