Skip to content

Commit 764bd02

Browse files
committed
Shader: Support setting uint arrays
1 parent e8da817 commit 764bd02

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

demosys/opengl/shader.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,52 @@ def uniform_4ui(self, name, x, y, z, w):
536536
uniform = self.uniform_check(name, GL.GL_UNSIGNED_INT_VEC4)
537537
GL.glUniform4ui(uniform.location, x, y, z, w)
538538

539+
# --- Unsigned Integer Arrays ---
540+
541+
def uniform_1uiv(self, name, value, count=1):
542+
"""
543+
Sets an uint
544+
545+
:param name: Name of the uniform
546+
:param value: integer array
547+
:param count: Length of the uniform array (default 1)
548+
"""
549+
uniform = self.uniform_check(name, GL.GL_UNSIGNED_INT)
550+
GL.glUniform1uiv(uniform.location, count, value)
551+
552+
def uniform_2uiv(self, name, value, count=1):
553+
"""
554+
Sets an uvec2
555+
556+
:param name: Uniform name
557+
:param value: integer array
558+
:param count: Length of the uniform array (default 1)
559+
"""
560+
uniform = self.uniform_check(name, GL.GL_UNSIGNED_INT_VEC2)
561+
GL.glUniform2uiv(uniform.location, count, value)
562+
563+
def uniform_3uiv(self, name, value, count=1):
564+
"""
565+
Sets an uvec3
566+
567+
:param name: Uniform name
568+
:param value: integer array
569+
:param count: Length of the uniform array (default 1)
570+
"""
571+
uniform = self.uniform_check(name, GL.GL_UNSIGNED_INT_VEC3)
572+
GL.glUniform3uiv(uniform.location, count, value)
573+
574+
def uniform_4uiv(self, name, value, count=1):
575+
"""
576+
Sets an uvec4
577+
578+
:param name: Uniform name
579+
:param value: integer array
580+
:param count: Length of the uniform array (default 1)
581+
"""
582+
uniform = self.uniform_check(name, GL.GL_UNSIGNED_INT_VEC4)
583+
GL.glUniform4uiv(uniform.location, count, value)
584+
539585
# --- Matrices ---
540586

541587
def uniform_mat3(self, name, mat):

0 commit comments

Comments
 (0)