mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
graphics: Remove Finalize
This commit is contained in:
parent
328ef85606
commit
ff30f01c1b
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user