Exemple #1
0
// SetVariablef sets a specified variable to the supplied integer to be passed
// into an effect.
func (effect *Effect) SetVariablef(variable string, val 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.Uniform1f(effect.uniforms[variable], gl.Float(val))
	return nil
}
Exemple #2
0
// SetVariable4i sets a specified variable to the four supplied integers to be
// passed into an effect.
func (effect *Effect) SetVariable4i(variable string, val1 int, val2 int, val3 int, val4 int) 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.Uniform4i(effect.uniforms[variable], gl.Int(val1), gl.Int(val2), gl.Int(val3), gl.Int(val4))
	return nil
}