Exemplo n.º 1
0
func (c *Context) UniformFloats(p Program, location string, v []float32) {
	l := int32(GetUniformLocation(c, p, location))
	switch len(v) {
	case 4:
		gl.Uniform4fv(l, 1, (*float32)(gl.Ptr(v)))
	case 16:
		gl.UniformMatrix4fv(l, 1, false, (*float32)(gl.Ptr(v)))
	default:
		panic("not reach")
	}
}
Exemplo n.º 2
0
func (c *Context) UniformFloats(p Program, location string, v []float32) {
	_ = c.runOnContextThread(func() error {
		l := int32(c.locationCache.GetUniformLocation(c, p, location))
		switch len(v) {
		case 4:
			gl.Uniform4fv(l, 1, (*float32)(gl.Ptr(v)))
		case 16:
			gl.UniformMatrix4fv(l, 1, false, (*float32)(gl.Ptr(v)))
		default:
			panic("not reach")
		}
		return nil
	})
}
Exemplo n.º 3
0
// Uniform4fv writes a vec4 uniform array of len(src)/4 elements.
//
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
func Uniform4fv(dst Uniform, src []float32) {
	gl.Uniform4fv(dst.Value, int32(len(src)/4), &src[0])
}