Remove TODOs

This commit is contained in:
Hajime Hoshi 2015-01-09 12:05:23 +09:00
parent 6453273bac
commit d96de18074
4 changed files with 4 additions and 5 deletions

View File

@ -110,6 +110,5 @@ func (f *Framebuffer) DrawTexture(c *opengl.Context, t *Texture, quads TextureQu
return err return err
} }
projectionMatrix := f.projectionMatrix() projectionMatrix := f.projectionMatrix()
// TODO: Define texture.Draw()
return shader.DrawTexture(c, t.native, projectionMatrix, quads, geo, clr) return shader.DrawTexture(c, t.native, projectionMatrix, quads, geo, clr)
} }

View File

@ -43,7 +43,8 @@ func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4
// unsafe.SizeOf can't be used because unsafe doesn't work with GopherJS. // unsafe.SizeOf can't be used because unsafe doesn't work with GopherJS.
const float32Size = 4 const float32Size = 4
// TODO: Check len(quads) and gl.MAX_ELEMENTS_INDICES? // TODO: WebGL doesn't seem to have Check gl.MAX_ELEMENTS_VERTICES or gl.MAX_ELEMENTS_INDICES so far.
// Let's use them to compare to len(quads).
const stride = 4 * 4 const stride = 4 * 4
if !initialized { if !initialized {
if err := initialize(c); err != nil { if err := initialize(c); err != nil {
@ -58,7 +59,8 @@ func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4
program := useProgramColorMatrix(c, glMatrix(projectionMatrix), geo, color) program := useProgramColorMatrix(c, glMatrix(projectionMatrix), geo, color)
// TODO: Do we have to call gl.ActiveTexture(gl.TEXTURE0)? // We don't have to call gl.ActiveTexture here: GL_TEXTURE0 is the default active texture
// See also: https://www.opengl.org/sdk/docs/man2/xhtml/glActiveTexture.xml
c.BindTexture(texture) c.BindTexture(texture)
c.EnableVertexAttribArray(program, "vertex") c.EnableVertexAttribArray(program, "vertex")

View File

@ -76,7 +76,6 @@ func (c *Context) TexturePixels(t Texture, width, height int) ([]uint8, error) {
gl.Texture(t).Bind(gl.TEXTURE_2D) gl.Texture(t).Bind(gl.TEXTURE_2D)
gl.GetTexImage(gl.TEXTURE_2D, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixels) gl.GetTexImage(gl.TEXTURE_2D, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixels)
if e := gl.GetError(); e != gl.NO_ERROR { if e := gl.GetError(); e != gl.NO_ERROR {
// TODO: Use glu.ErrorString
return nil, errors.New(fmt.Sprintf("gl error: %d", e)) return nil, errors.New(fmt.Sprintf("gl error: %d", e))
} }
return pixels, nil return pixels, nil

View File

@ -89,7 +89,6 @@ func (c *Context) TexturePixels(t Texture, width, height int) ([]uint8, error) {
gl.BindTexture(gl.TEXTURE_2D, t) gl.BindTexture(gl.TEXTURE_2D, t)
gl.ReadPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels) gl.ReadPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels)
if e := gl.GetError(); e != gl.NO_ERROR { if e := gl.GetError(); e != gl.NO_ERROR {
// TODO: Use glu.ErrorString
return nil, errors.New(fmt.Sprintf("gl error: %d", e)) return nil, errors.New(fmt.Sprintf("gl error: %d", e))
} }
return pixels.Interface().([]uint8), nil return pixels.Interface().([]uint8), nil