Skip to content

Commit

Permalink
opengl: Add coments about #629
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed Sep 28, 2018
1 parent eb0f0e6 commit c4abed0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/opengl/context_js.go
Expand Up @@ -182,9 +182,13 @@ func (c *Context) NewTexture(width, height int) (Texture, error) {
gl.Call("texParameteri", texture2d, textureWrapS, clampToEdge)
gl.Call("texParameteri", texture2d, textureWrapT, clampToEdge)

// void texImage2D(GLenum target, GLint level, GLenum internalformat,
// GLsizei width, GLsizei height, GLint border, GLenum format,
// GLenum type, ArrayBufferView? pixels);
// Firefox warns the usage of textures without specifying pixels (#629)
//
// Error: WebGL warning: drawElements: This operation requires zeroing texture data. This is slow.
//
// In Ebiten, textures are filled with pixels laster by the filter that ignores destination, so it is fine
// to leave textures as uninitialized here. Rather, extra memory allocating for initialization should be
// avoided.
gl.Call("texImage2D", texture2d, 0, rgba, width, height, 0, rgba, unsignedByte, nil)

return Texture(t), nil
Expand Down

0 comments on commit c4abed0

Please sign in to comment.