func (p *Pipeline) Bind() {
	if currentPipeline != p {
		C.BindPipeline(p.object, p.vao, &p.state)
		currentPipeline = p
	}
}
//////////////////////////////////////////////////////////////////////////////
Bind the pipeline for use by the GPU in all following draw commands.
package gl
import (
	"errors"
	"unsafe"
)
import "C"
func clearPipelineCurrentState() {
	C.currentState.topology = C.GL_TRIANGLES
	C.currentState.primitiveRestart = C.GL_FALSE
	C.currentState.depthClamp = C.GL_TRUE
	C.currentState.rasterizerDiscard = C.GL_FALSE
	C.currentState.cullMode = C.GL_NONE
	C.currentState.frontFace = C.GL_CCW
	C.currentState.depthTest = C.GL_FALSE
	C.currentState.depthWrite = C.GL_FALSE
	C.currentState.depthComparison = C.GL_LESS
	C.currentState.stencilTest = C.GL_FALSE
}
type Pipeline struct {
	object C.GLuint
	vao    C.GLuint
	state  C.PipelineState
}
type PipelineConfig func(*Pipeline)
func NewPipeline(o ...PipelineConfig) *Pipeline {
	var p Pipeline
	p.state.topology = C.GL_TRIANGLES
	p.state.primitiveRestart = C.GL_FALSE
	p.state.depthClamp = C.GL_TRUE
	p.state.rasterizerDiscard = C.GL_FALSE
	p.state.cullMode = C.GL_NONE
	p.state.frontFace = C.GL_CCW
	p.state.depthTest = C.GL_FALSE
	p.state.depthWrite = C.GL_FALSE
	p.state.depthComparison = C.GL_LESS
	p.state.stencilTest = C.GL_FALSE
	p.object = C.NewPipeline()  
	p.vao = C.CreateVAO()       
	oObj, oVao := p.object, p.vao
	for _, f := range o {
		f(&p)
	}
	C.PipelineLinkProgram(p.object)
	if errm := C.PipelineLinkError(p.object); errm != nil {
		defer C.free(unsafe.Pointer(errm))
		setErr(errors.New("gl shaders linking" + C.GoString(errm)))
	}
	if oObj != p.object {
		C.DeletePipelineProgram(oObj)
	}
	if oVao != p.vao {
		C.DeletePipelineVAO(oVao)
	}
	return &p
}
func (p *Pipeline) attachShader(s shader) {
	C.PipelineAttachShader(p.object, s.stages, s.shader)
	return
}
func ClearColorBuffer(c struct{ R, G, B, A float32 }) {
	C.ClearColorBuffer((*C.GLfloat)(unsafe.Pointer(&c)))
}
func ClearDepthBuffer(d float32) {
	C.ClearDepthBuffer((C.GLfloat)(d))
}
func ClearStencilBuffer(m int32) {
	C.ClearStencilBuffer((C.GLint)(m))
}