Skip to content

Commit 77ed921

Browse files
committed
Shader: Support setting sampler3D
1 parent 90a7b4a commit 77ed921

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

demosys/opengl/shader.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,19 @@ def uniform_mat4(self, name, mat):
518518

519519
# --- Sampler ---
520520

521+
def uniform_sampler_1d(self, unit, name, texture):
522+
"""
523+
Sets a sampler1d
524+
525+
:param unit: The texture unit to use (0 - N)
526+
:param name: Name of the uniform
527+
:param texture: The Texture object
528+
"""
529+
uniform = self.uniform(name)
530+
GL.glActiveTexture(GL.GL_TEXTURE0 + unit)
531+
texture.bind()
532+
GL.glUniform1i(uniform.location, unit)
533+
521534
def uniform_sampler_2d(self, unit, name, texture):
522535
"""
523536
Sets a sampler2d
@@ -531,9 +544,9 @@ def uniform_sampler_2d(self, unit, name, texture):
531544
texture.bind()
532545
GL.glUniform1i(uniform.location, unit)
533546

534-
def uniform_sampler_1d(self, unit, name, texture):
547+
def uniform_sampler_3d(self, unit, name, texture):
535548
"""
536-
Sets a sampler1d
549+
Sets a sampler3d
537550
538551
:param unit: The texture unit to use (0 - N)
539552
:param name: Name of the uniform

0 commit comments

Comments
 (0)