func (p *glParams) renderCreate() error { context := p.context //align := 4 checkError(context, "init") if p.edgeAntiAlias() { err := context.shader.createShader("shader", shaderHeader, "#define EDGE_AA 1", fillVertexShader, fillFragmentShader) if err != nil { return err } } else { err := context.shader.createShader("shader", shaderHeader, "", fillVertexShader, fillFragmentShader) if err != nil { return err } } checkError(context, "init") context.shader.getUniforms() context.vertexBuffer = gl.CreateBuffer() context.vertexBuffer = gl.CreateBuffer() checkError(context, "create done") gl.Finish() return nil }
func (s *vertexStream) newContext() *vertexStreamContext { buffer := gl.CreateBuffer() gl.BindBuffer(gl.ARRAY_BUFFER, buffer) gl.BufferData(gl.ARRAY_BUFFER, s.data, gl.STATIC_DRAW) gl.BindBuffer(gl.ARRAY_BUFFER, gl.Buffer{}) checkError() return &vertexStreamContext{buffer} }
func (b *indexBuffer) newContext() *indexBufferContext { dataVal := reflect.ValueOf(b.data) length := dataVal.Len() / 2 // HACK: Hardcode support for only ptUshort. buffer := gl.CreateBuffer() gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer) gl.BufferData(gl.ELEMENT_ARRAY_BUFFER, b.data, gl.STATIC_DRAW) gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, gl.Buffer{}) checkError() return &indexBufferContext{ buffer: buffer, ty: b.ty, length: length, } }