func SetUniformV2(shader, variable string, v linear.Vec2) { prog, ok := shader_progs[shader] if !ok { if !warned_names[shader] { Warn().Printf("Tried to set a uniform in an unknown shader '%s'", shader) warned_names[shader] = true } return } bvariable := []byte(fmt.Sprintf("%s\x00", variable)) loc := gl.GetUniformLocation(prog, (*gl.Char)(unsafe.Pointer(&bvariable[0]))) gl.Uniform2f(loc, gl.Float(v.X), gl.Float(v.Y)) }
// SetVariable2f sets a specified variable to the two supplied integers to // be passed into an effect. func (effect *Effect) SetVariable2f(variable string, val1 float32, val2 float32) error { var currEffect gl.Int gl.GetIntegerv(gl.CURRENT_PROGRAM, &currEffect) if gl.Uint(currEffect) != effect.program { return errors.New("effect is not currently in use") } effect.checkUniformVariable(variable) gl.Uniform2f(effect.uniforms[variable], gl.Float(val1), gl.Float(val2)) return nil }