func start() { var err error glimage.program, err = CreateProgram(vertexShader, fragmentShader) if err != nil { panic(err) } glimage.quadXY = gl.CreateBuffer() glimage.quadUV = gl.CreateBuffer() gl.BindBuffer(gl.ARRAY_BUFFER, glimage.quadXY) gl.BufferData(gl.ARRAY_BUFFER, quadXYCoords, gl.STATIC_DRAW) gl.BindBuffer(gl.ARRAY_BUFFER, glimage.quadUV) gl.BufferData(gl.ARRAY_BUFFER, quadUVCoords, gl.STATIC_DRAW) glimage.pos = gl.GetAttribLocation(glimage.program, "pos") glimage.mvp = gl.GetUniformLocation(glimage.program, "mvp") glimage.uvp = gl.GetUniformLocation(glimage.program, "uvp") glimage.inUV = gl.GetAttribLocation(glimage.program, "inUV") glimage.textureSample = gl.GetUniformLocation(glimage.program, "textureSample") texmap.Lock() defer texmap.Unlock() for key, tex := range texmap.texs { texmap.init(key) tex.needsUpload = true } }
func onStart() { var err error program, err = glutil.CreateProgram(vertexShader, fragmentShader) if err != nil { log.Printf("error creating GL program: %v", err) return } buf = gl.CreateBuffer() gl.BindBuffer(gl.ARRAY_BUFFER, buf) gl.BufferData(gl.ARRAY_BUFFER, triangleData, gl.STATIC_DRAW) position = gl.GetAttribLocation(program, "position") color = gl.GetUniformLocation(program, "color") offset = gl.GetUniformLocation(program, "offset") // TODO(crawshaw): the debug package needs to put GL state init here // Can this be an app.RegisterFilter call now?? }