Esempio n. 1
0
func (c *Context) DeleteBuffer(b Buffer) {
	_ = c.runOnContextThread(func() error {
		bb := uint32(b)
		gl.DeleteBuffers(1, &bb)
		return nil
	})
}
Esempio n. 2
0
func main() {
	if err := glfw.Init(); err != nil {
		log.Fatalln("failed to initialize glfw:", err)
	}
	defer glfw.Terminate()

	glfw.WindowHint(glfw.Resizable, glfw.False)
	glfw.WindowHint(glfw.ContextVersionMajor, 2)
	glfw.WindowHint(glfw.ContextVersionMinor, 1)
	window, err := glfw.CreateWindow(640, 480, "tut02", nil, nil)
	if err != nil {
		panic(err)
	}
	window.MakeContextCurrent()

	if err := gl.Init(); err != nil {
		panic(err)
	}

	program, coords := initResources()
	for {
		onDisplay(program, uint32(coords))
		window.SwapBuffers()
	}

	gl.DeleteProgram(program)
	gl.DeleteBuffers(1, &vboTriangle)
}
Esempio n. 3
0
func main() {
	if err := glfw.Init(); err != nil {
		log.Fatalln("failed to initialize glfw:", err)
	}
	defer glfw.Terminate()

	glfw.WindowHint(glfw.Resizable, glfw.False)
	glfw.WindowHint(glfw.ContextVersionMajor, 2)
	glfw.WindowHint(glfw.ContextVersionMinor, 1)
	window, err := glfw.CreateWindow(640, 480, "tut03", nil, nil)
	if err != nil {
		panic(err)
	}
	window.MakeContextCurrent()

	if err := gl.Init(); err != nil {
		panic(err)
	}

	t0 := time.Now()
	program := initResources()
	for {
		curFade = float32(math.Sin(time.Now().Sub(t0).Seconds()*2*math.Pi/5)/2 + 0.5)
		onDisplay(program)
		window.SwapBuffers()
		glfw.PollEvents()
	}

	gl.DeleteProgram(program)
	gl.DeleteBuffers(1, &vboTriangle)
}
Esempio n. 4
0
// DeleteBuffer deletes the given buffer object.
//
// http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteBuffers.xhtml
func DeleteBuffer(v Buffer) {
	gl.DeleteBuffers(1, &v.Value)
}
Esempio n. 5
0
func (buffer *Buffer) Delete() {
	gl.DeleteBuffers(1, &buffer.id)
}