Ejemplo n.º 1
0
func (uniform Uniform) SetSampler(data ...int32) {
	fmt.Printf("set %#v\n", uniform)
	switch uniform.typ {
	case gl.SAMPLER, gl.SAMPLER_1D, gl.SAMPLER_2D, gl.SAMPLER_3D:
		gl.ProgramUniform1iv(uniform.program.id, uniform.Location(), uniform.siz, &data[0])
	default:
		panic(fmt.Errorf("Unusable gl type '%04X", uniform.typ))
	}
}
Ejemplo n.º 2
0
func (uniform Uniform) SetInt(data ...int32) {
	fmt.Printf("set %#v\n", uniform)
	switch uniform.typ {
	case gl.INT:
		gl.ProgramUniform1iv(uniform.program.id, uniform.Location(), uniform.siz, &data[0])
	case gl.INT_VEC2:
		gl.ProgramUniform2iv(uniform.program.id, uniform.Location(), uniform.siz, &data[0])
	case gl.INT_VEC3:
		gl.ProgramUniform3iv(uniform.program.id, uniform.Location(), uniform.siz, &data[0])
	case gl.INT_VEC4:
		gl.ProgramUniform4iv(uniform.program.id, uniform.Location(), uniform.siz, &data[0])
	default:
		panic(fmt.Errorf("Unusable gl type '%04X", uniform.typ))
	}
}