graphics: Remove Finalize

This commit is contained in:
Hajime Hoshi 2016-06-30 00:21:47 +09:00
parent 328ef85606
commit ff30f01c1b
4 changed files with 0 additions and 51 deletions

View File

@ -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 { func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsage BufferUsage) Buffer {
var buffer Buffer var buffer Buffer
c.RunOnContextThread(func() error { 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) { func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) {
c.RunOnContextThread(func() error { c.RunOnContextThread(func() error {
gl.DrawElements(uint32(mode), int32(len), gl.UNSIGNED_SHORT, gl.PtrOffset(offsetInBytes)) gl.DrawElements(uint32(mode), int32(len), gl.UNSIGNED_SHORT, gl.PtrOffset(offsetInBytes))

View File

@ -363,11 +363,6 @@ func (c *Context) DisableVertexAttribArray(p Program, location string) {
gl.DisableVertexAttribArray(int(l)) 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 { func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsage BufferUsage) Buffer {
gl := c.gl gl := c.gl
b := gl.CreateBuffer() b := gl.CreateBuffer()
@ -386,11 +381,6 @@ func (c *Context) BufferSubData(bufferType BufferType, data []int16) {
gl.BufferSubData(int(bufferType), 0, data) 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) { func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) {
gl := c.gl gl := c.gl
gl.DrawElements(int(mode), len, gl.UNSIGNED_SHORT, offsetInBytes) gl.DrawElements(int(mode), len, gl.UNSIGNED_SHORT, offsetInBytes)

View File

@ -340,11 +340,6 @@ func (c *Context) DisableVertexAttribArray(p Program, location string) {
gl.DisableVertexAttribArray(mgl.Attrib(l)) gl.DisableVertexAttribArray(mgl.Attrib(l))
} }
func (c *Context) DeleteProgram(p Program) {
gl := c.gl
gl.DeleteProgram(mgl.Program(p))
}
func uint16ToBytes(v []uint16) []byte { func uint16ToBytes(v []uint16) []byte {
b := make([]byte, len(v)*2) b := make([]byte, len(v)*2)
for i, x := range v { 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)) 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) { func (c *Context) DrawElements(mode Mode, len int, offsetInBytes int) {
gl := c.gl gl := c.gl
gl.DrawElements(mgl.Enum(mode), len, mgl.UNSIGNED_SHORT, offsetInBytes) gl.DrawElements(mgl.Enum(mode), len, mgl.UNSIGNED_SHORT, offsetInBytes)

View File

@ -53,10 +53,6 @@ func Initialize(c *opengl.Context) error {
return theOpenGLState.initialize(c) return theOpenGLState.initialize(c)
} }
func Finalize(c *opengl.Context) error {
return theOpenGLState.finalize(c)
}
func (s *openGLState) initialize(c *opengl.Context) error { func (s *openGLState) initialize(c *opengl.Context) error {
s.lastProgram = zeroProgram s.lastProgram = zeroProgram
s.lastProjectionMatrix = nil s.lastProjectionMatrix = nil
@ -102,18 +98,6 @@ func (s *openGLState) initialize(c *opengl.Context) error {
return nil 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 { func areSameFloat32Array(a, b []float32) bool {
if len(a) != len(b) { if len(a) != len(b) {
return false return false