Skip to content

Commit

Permalink
Fix uniforms in pyglet.graphics.shader (#1103)
Browse files Browse the repository at this point in the history
Fixing a bug in Pyglet where the `Uniform` object doesn't have the reference to the `ShaderProgram` it belongs to.

This causes problems when we try to write a numpy array to the uniform object.
  • Loading branch information
salehqt committed May 7, 2024
1 parent c226c60 commit 03c2da1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyglet/graphics/shader.py
Expand Up @@ -322,12 +322,13 @@ def __repr__(self):


class _Uniform:
__slots__ = 'type', 'size', 'location', 'length', 'count', 'get', 'set'
__slots__ = 'type', 'size', 'location', 'length', 'count', 'get', 'set', 'program'

def __init__(self, program, uniform_type, size, location, dsa):
self.type = uniform_type
self.size = size
self.location = location
self.program = program

gl_type, gl_setter_legacy, gl_setter_dsa, length = _uniform_setters[uniform_type]
gl_setter = gl_setter_dsa if dsa else gl_setter_legacy
Expand Down

0 comments on commit 03c2da1

Please sign in to comment.