Reduce calling glFlush

This commit is contained in:
Hajime Hoshi 2015-01-03 01:14:36 +09:00
parent 47227139db
commit ae04bb17f6
4 changed files with 3 additions and 3 deletions

View File

@ -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
} }

View File

@ -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)

View File

@ -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)

View File

@ -31,7 +31,7 @@ func Use(f func(*opengl.Context)) {
} }
func DoEvents() { func DoEvents() {
time.Sleep(1) time.Sleep(0)
} }
func Terminate() { func Terminate() {