From ff30f01c1bdbe8e1a32b1fdf492d41c33a4b4bcc Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 30 Jun 2016 00:21:47 +0900 Subject: [PATCH] graphics: Remove Finalize --- internal/graphics/opengl/context_desktop.go | 15 --------------- internal/graphics/opengl/context_js.go | 10 ---------- internal/graphics/opengl/context_mobile.go | 10 ---------- internal/graphics/program.go | 16 ---------------- 4 files changed, 51 deletions(-) diff --git a/internal/graphics/opengl/context_desktop.go b/internal/graphics/opengl/context_desktop.go index 5f48057e8..2ea6bc113 100644 --- a/internal/graphics/opengl/context_desktop.go +++ b/internal/graphics/opengl/context_desktop.go @@ -453,13 +453,6 @@ func (c *Context) DisableVertexAttribArray(p Program, location string) { }) } -func (c *Context) DeleteProgram(p Program) { - c.RunOnContextThread(func() error { - gl.DeleteProgram(uint32(p)) - return nil - }) -} - func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsage BufferUsage) Buffer { var buffer Buffer c.RunOnContextThread(func() error { @@ -494,14 +487,6 @@ func (c *Context) BufferSubData(bufferType BufferType, data []int16) { }) } -func (c *Context) DeleteBuffer(b Buffer) { - c.RunOnContextThread(func() error { - bb := uint32(b) - gl.DeleteBuffers(1, &bb) - return nil - }) -} - func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) { c.RunOnContextThread(func() error { gl.DrawElements(uint32(mode), int32(len), gl.UNSIGNED_SHORT, gl.PtrOffset(offsetInBytes)) diff --git a/internal/graphics/opengl/context_js.go b/internal/graphics/opengl/context_js.go index c9ed54f0d..aa7f8a68c 100644 --- a/internal/graphics/opengl/context_js.go +++ b/internal/graphics/opengl/context_js.go @@ -363,11 +363,6 @@ func (c *Context) DisableVertexAttribArray(p Program, location string) { gl.DisableVertexAttribArray(int(l)) } -func (c *Context) DeleteProgram(p Program) { - gl := c.gl - gl.DeleteProgram(p.Object) -} - func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsage BufferUsage) Buffer { gl := c.gl b := gl.CreateBuffer() @@ -386,11 +381,6 @@ func (c *Context) BufferSubData(bufferType BufferType, data []int16) { gl.BufferSubData(int(bufferType), 0, data) } -func (c *Context) DeleteBuffer(b Buffer) { - gl := c.gl - gl.DeleteBuffer(b.Object) -} - func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) { gl := c.gl gl.DrawElements(int(mode), len, gl.UNSIGNED_SHORT, offsetInBytes) diff --git a/internal/graphics/opengl/context_mobile.go b/internal/graphics/opengl/context_mobile.go index f39ba1a98..3d782396f 100644 --- a/internal/graphics/opengl/context_mobile.go +++ b/internal/graphics/opengl/context_mobile.go @@ -340,11 +340,6 @@ func (c *Context) DisableVertexAttribArray(p Program, location string) { gl.DisableVertexAttribArray(mgl.Attrib(l)) } -func (c *Context) DeleteProgram(p Program) { - gl := c.gl - gl.DeleteProgram(mgl.Program(p)) -} - func uint16ToBytes(v []uint16) []byte { b := make([]byte, len(v)*2) for i, x := range v { @@ -388,11 +383,6 @@ func (c *Context) BufferSubData(bufferType BufferType, data []int16) { gl.BufferSubData(mgl.Enum(bufferType), 0, int16ToBytes(data)) } -func (c *Context) DeleteBuffer(b Buffer) { - gl := c.gl - gl.DeleteBuffer(mgl.Buffer(b)) -} - func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) { gl := c.gl gl.DrawElements(mgl.Enum(mode), len, mgl.UNSIGNED_SHORT, offsetInBytes) diff --git a/internal/graphics/program.go b/internal/graphics/program.go index 486ab5990..9fc08c1e2 100644 --- a/internal/graphics/program.go +++ b/internal/graphics/program.go @@ -53,10 +53,6 @@ func Initialize(c *opengl.Context) error { return theOpenGLState.initialize(c) } -func Finalize(c *opengl.Context) error { - return theOpenGLState.finalize(c) -} - func (s *openGLState) initialize(c *opengl.Context) error { s.lastProgram = zeroProgram s.lastProjectionMatrix = nil @@ -102,18 +98,6 @@ func (s *openGLState) initialize(c *opengl.Context) error { return nil } -func (s *openGLState) finalize(c *opengl.Context) error { - s.lastProgram = zeroProgram - s.lastProjectionMatrix = nil - s.lastModelviewMatrix = nil - s.lastColorMatrix = nil - s.lastColorMatrixTranslation = nil - s.lastTexture = zeroTexture - c.DeleteBuffer(s.indexBufferQuads) - c.DeleteProgram(s.programTexture) - return nil -} - func areSameFloat32Array(a, b []float32) bool { if len(a) != len(b) { return false