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
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
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
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
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])
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()
def test_int(self): uniform = Uniform(None, "A", gl.GL_INT) assert uniform.data.dtype == np.int32 assert uniform.data.size == 1
def test_vec4(self): uniform = Uniform(None, "A", gl.GL_FLOAT_VEC2) assert uniform.data.dtype == np.float32 assert uniform.data.size == 2
def test_float(self): uniform = Uniform(None, "A", gl.GL_FLOAT) assert uniform.data.dtype == np.float32 assert uniform.data.size == 1
def test_init(self): uniform = Uniform(None, "A", gl.GL_FLOAT) assert uniform.texture_unit == -1
def test_mat2(self): uniform = Uniform(None, "A", gl.GL_FLOAT_MAT2) assert uniform.data.dtype == np.float32 assert uniform.data.size == 4