Skip to main content

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.

0.0.3 (2021-02-27)
-------------------
- Fixed description.

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.3.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file shaderpy-0.0.3.tar.gz.

File metadata

  • Download URL: shaderpy-0.0.3.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

Hashes for shaderpy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e11098accd3c018aca4fbdfad4e08416b8f334505d6240c36643a7ee7235f049
MD5 d9bb0beeab8f2c5b95ca5f0b2d9ad680
BLAKE2b-256 2b79a0c3dcbc58bcf7362b090d56c4d7261c21331e384d312289847b2de1027e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page