Skip to content

Commit ff313cb

Browse files
committed
Shader: Support mat2 uniforms
1 parent f3f3327 commit ff313cb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

demosys/opengl/shader.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,19 @@ def uniform_4b(self, name, x, y, z, w):
632632

633633
# --- Matrices ---
634634

635+
def uniform_mat2(self, name, mat, transpose=GL.GL_FALSE):
636+
"""
637+
Sets a mat3 uniform
638+
639+
:param name: Name of the uniform
640+
:param mat: matrix
641+
:param transpose: Traspose the matrix
642+
"""
643+
if mat is None:
644+
raise ShaderError("Attempted to set uniform to None")
645+
uniform = self.uniform_check(name, GL.GL_FLOAT_MAT2)
646+
GL.glUniformMatrix2fv(uniform.location, 1, transpose, mat)
647+
635648
def uniform_mat3(self, name, mat, transpose=GL.GL_FALSE):
636649
"""
637650
Sets a mat3 uniform

0 commit comments

Comments
 (0)