From c4abed0a228b509e10fd4abcadd80b3799be79ad Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 29 Sep 2018 02:20:02 +0900 Subject: [PATCH] opengl: Add coments about #629 --- internal/opengl/context_js.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/opengl/context_js.go b/internal/opengl/context_js.go index 81b7be62575f..d64024d55abb 100644 --- a/internal/opengl/context_js.go +++ b/internal/opengl/context_js.go @@ -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