예제 #1
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()
예제 #2
0
    def test_set_exception(self):
        uniform = Uniform("A", gl.GL_FLOAT_VEC4)

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

        with self.assertRaises(ValueError):
            uniform.set_data([1,2,3,4,5])
예제 #3
0
    def test_set_exception(self):
        uniform = Uniform(None, "A", gl.GL_FLOAT_VEC4)

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

        # with self.assertRaises(ValueError):
        #    uniform.set_data([1, 2, 3, 4, 5])
        self.assertRaises(ValueError, uniform.set_data, [1, 2, 3, 4, 5])
예제 #4
0
    def test_set(self):
        uniform = Uniform("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()
예제 #5
0
 def test_mat4(self):
     uniform = Uniform("A", gl.GL_FLOAT_MAT4)
     assert uniform.dtype == np.float32
     assert uniform.size == 16
예제 #6
0
 def test_int(self):
     uniform = Uniform("A", gl.GL_INT)
     assert uniform.dtype == np.int32
     assert uniform.size == 1
예제 #7
0
 def test_vec4(self):
     uniform = Uniform("A", gl.GL_FLOAT_VEC2)
     assert uniform.dtype == np.float32
     assert uniform.size == 2
예제 #8
0
 def test_float(self):
     uniform = Uniform("A", gl.GL_FLOAT)
     assert uniform.dtype == np.float32
     assert uniform.size == 1
예제 #9
0
 def test_init(self):
     uniform = Uniform("A", gl.GL_FLOAT)
     assert uniform.texture_unit == -1
예제 #10
0
 def test_mat3(self):
     uniform = Uniform(None, "A", gl.GL_FLOAT_MAT3)
     assert uniform.data.dtype == np.float32
     assert uniform.data.size == 9
예제 #11
0
 def test_vec3(self):
     uniform = Uniform(None, "A", gl.GL_FLOAT_VEC2)
     assert uniform.data.dtype == np.float32
     assert uniform.data.size == 2
예제 #12
0
 def test_init(self):
     uniform = Uniform(None, "A", gl.GL_FLOAT)
     assert uniform._unit == -1