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.

0.0.4 (2021-02-27)

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

Uploaded Source

File details

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

File metadata

  • Download URL: shaderpy-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 3af21bf8fdeea711b57fe56b469fa93aa53a72399ea89dca3417c59a22593a5b
MD5 8a6eaa5aef65404f400a78b2eedda9a5
BLAKE2b-256 07fa04be12b70de4be4fb4f1c43a4a04567d1b820cca587c42b610775f3ae6f2

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