mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Reduce calling glFlush
This commit is contained in:
parent
47227139db
commit
ae04bb17f6
@ -86,7 +86,5 @@ func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix [4]
|
|||||||
}
|
}
|
||||||
c.BufferSubData(c.ArrayBuffer, vertices)
|
c.BufferSubData(c.ArrayBuffer, vertices)
|
||||||
c.DrawElements(6 * quads.Len())
|
c.DrawElements(6 * quads.Len())
|
||||||
|
|
||||||
c.Flush()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ func (c *Context) NewTexture(width, height int, pixels []uint8, filter FilterTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) TexturePixels(t Texture, width, height int) ([]uint8, error) {
|
func (c *Context) TexturePixels(t Texture, width, height int) ([]uint8, error) {
|
||||||
|
gl.Flush()
|
||||||
// TODO: Use glGetTexLevelParameteri and GL_TEXTURE_WIDTH?
|
// TODO: Use glGetTexLevelParameteri and GL_TEXTURE_WIDTH?
|
||||||
pixels := make([]uint8, 4*width*height)
|
pixels := make([]uint8, 4*width*height)
|
||||||
gl.Texture(t).Bind(gl.TEXTURE_2D)
|
gl.Texture(t).Bind(gl.TEXTURE_2D)
|
||||||
|
@ -84,6 +84,7 @@ func (c *Context) NewTexture(width, height int, pixels []uint8, filter FilterTyp
|
|||||||
|
|
||||||
func (c *Context) TexturePixels(t Texture, width, height int) ([]uint8, error) {
|
func (c *Context) TexturePixels(t Texture, width, height int) ([]uint8, error) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
|
gl.Flush()
|
||||||
// TODO: Use glGetTexLevelParameteri and GL_TEXTURE_WIDTH?
|
// TODO: Use glGetTexLevelParameteri and GL_TEXTURE_WIDTH?
|
||||||
pixels := js.Global.Get("Uint8Array").New(4 * width * height)
|
pixels := js.Global.Get("Uint8Array").New(4 * width * height)
|
||||||
gl.BindTexture(gl.TEXTURE_2D, t)
|
gl.BindTexture(gl.TEXTURE_2D, t)
|
||||||
|
@ -31,7 +31,7 @@ func Use(f func(*opengl.Context)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DoEvents() {
|
func DoEvents() {
|
||||||
time.Sleep(1)
|
time.Sleep(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Terminate() {
|
func Terminate() {
|
||||||
|
Loading…
Reference in New Issue
Block a user