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

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

Uploaded Source

File details

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

File metadata

  • Download URL: shaderpy-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 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.1.tar.gz
Algorithm Hash digest
SHA256 569e22945df4632e5e3608362e8e46b8507e5ef2f812e3a060df9992df648400
MD5 0c1aa826662e4012e68b6de4195bd88c
BLAKE2b-256 ef66de133b0c87d45a144714ca9401f4082dba8f9d866695c3e2451a7251af2b

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