Пример #1
0
    def build_uniforms(self):
        """ Build the uniform objects """

        self._uniforms = {}
        texture_count = 1
        for (name, gtype) in self.all_uniforms:
            uniform = Uniform(self, name, gtype)
            if gtype in (gl.GL_SAMPLER_2D, gl.GL_SAMPLER_CUBE):
                uniform.texture_unit = texture_count
                texture_count += 1
            self._uniforms[name] = uniform
Пример #2
0
    def build_uniforms(self):
        """ Build the uniform objects """

        self._uniforms = {}
        texture_count = 1
        for (name,gtype) in self.all_uniforms:
            uniform = Uniform(self, name, gtype)
            if gtype in (gl.GL_SAMPLER_2D, gl.GL_SAMPLER_CUBE):
                uniform.texture_unit = texture_count
                texture_count += 1
            self._uniforms[name] = uniform
Пример #3
0
    def _build_uniforms(self):
        """ Build the uniform objects """

        self._uniforms = {}
        count = 0
        for (name, gtype) in self.all_uniforms:
            uniform = Uniform(self, name, gtype)
            if gtype in (gl.GL_SAMPLER_1D, gl.GL_SAMPLER_2D):
                uniform._unit = count
                count += 1
            self._uniforms[name] = uniform
        self._need_update = True
Пример #4
0
    def _build_uniforms(self):
        """ Build the uniform objects """

        self._uniforms = {}
        count = 0
        for (name,gtype) in self.all_uniforms:
            uniform = Uniform(self, name, gtype)
            if gtype in (gl.GL_SAMPLER_1D, gl.GL_SAMPLER_2D):
                uniform._unit = count
                count += 1
            self._uniforms[name] = uniform
        self._need_update = True
Пример #5
0
    def test_set_exception(self):
        uniform = Uniform(None, "A", gl.GL_FLOAT_VEC4)

        with self.assertRaises(VariableException):
            uniform.set_data([1,2])

        with self.assertRaises(VariableException):
            uniform.set_data([1,2,3,4,5])
Пример #6
0
    def test_set(self):
        uniform = Uniform(None, "A", gl.GL_FLOAT_VEC4)

        uniform.set_data(1)
        assert (uniform.data == 1).all()

        uniform.set_data([1,2,3,4])
        assert (uniform.data == [1,2,3,4]).all()
Пример #7
0
 def test_int(self):
     uniform = Uniform(None, "A", gl.GL_INT)
     assert uniform.data.dtype == np.int32
     assert uniform.data.size == 1
Пример #8
0
 def test_vec4(self):
     uniform = Uniform(None, "A", gl.GL_FLOAT_VEC2)
     assert uniform.data.dtype == np.float32
     assert uniform.data.size == 2
Пример #9
0
 def test_float(self):
     uniform = Uniform(None, "A", gl.GL_FLOAT)
     assert uniform.data.dtype == np.float32
     assert uniform.data.size == 1
Пример #10
0
 def test_init(self):
     uniform = Uniform(None, "A", gl.GL_FLOAT)
     assert uniform.texture_unit == -1
Пример #11
0
 def test_mat2(self):
     uniform = Uniform(None, "A", gl.GL_FLOAT_MAT2)
     assert uniform.data.dtype == np.float32
     assert uniform.data.size == 4