From d96de18074292cc6f74e21c98d3a75ac63fd5f4b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 9 Jan 2015 12:05:23 +0900 Subject: [PATCH] Remove TODOs --- internal/graphics/framebuffer.go | 1 - internal/graphics/internal/shader/drawtexture.go | 6 ++++-- internal/opengl/context.go | 1 - internal/opengl/context_js.go | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/graphics/framebuffer.go b/internal/graphics/framebuffer.go index b65a23832..d4e3915d4 100644 --- a/internal/graphics/framebuffer.go +++ b/internal/graphics/framebuffer.go @@ -110,6 +110,5 @@ func (f *Framebuffer) DrawTexture(c *opengl.Context, t *Texture, quads TextureQu return err } projectionMatrix := f.projectionMatrix() - // TODO: Define texture.Draw() return shader.DrawTexture(c, t.native, projectionMatrix, quads, geo, clr) } diff --git a/internal/graphics/internal/shader/drawtexture.go b/internal/graphics/internal/shader/drawtexture.go index 60022ab29..5e63e7765 100644 --- a/internal/graphics/internal/shader/drawtexture.go +++ b/internal/graphics/internal/shader/drawtexture.go @@ -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. 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 if !initialized { 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) - // 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.EnableVertexAttribArray(program, "vertex") diff --git a/internal/opengl/context.go b/internal/opengl/context.go index bd8ed79e6..9e593d28f 100644 --- a/internal/opengl/context.go +++ b/internal/opengl/context.go @@ -76,7 +76,6 @@ func (c *Context) TexturePixels(t Texture, width, height int) ([]uint8, error) { gl.Texture(t).Bind(gl.TEXTURE_2D) gl.GetTexImage(gl.TEXTURE_2D, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixels) if e := gl.GetError(); e != gl.NO_ERROR { - // TODO: Use glu.ErrorString return nil, errors.New(fmt.Sprintf("gl error: %d", e)) } return pixels, nil diff --git a/internal/opengl/context_js.go b/internal/opengl/context_js.go index ef90e6f77..3c023e79a 100644 --- a/internal/opengl/context_js.go +++ b/internal/opengl/context_js.go @@ -89,7 +89,6 @@ func (c *Context) TexturePixels(t Texture, width, height int) ([]uint8, error) { gl.BindTexture(gl.TEXTURE_2D, t) gl.ReadPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels) if e := gl.GetError(); e != gl.NO_ERROR { - // TODO: Use glu.ErrorString return nil, errors.New(fmt.Sprintf("gl error: %d", e)) } return pixels.Interface().([]uint8), nil