graphicsdriver/opengl: Enable to bind multiple textures (in theory)

This commit is contained in:
Hajime Hoshi
2020-05-17 23:04:13 +09:00
parent 733c463e26
commit 7f2092f964
8 changed files with 66 additions and 8 deletions

View File

@@ -112,6 +112,8 @@ var (
unsignedByte js.Value
unsignedShort js.Value
texture0 int
isWebGL2Available bool
)
@@ -154,6 +156,7 @@ func init() {
nearest = contextPrototype.Get("NEAREST")
noError = contextPrototype.Get("NO_ERROR")
rgba = contextPrototype.Get("RGBA")
texture0 = contextPrototype.Get("TEXTURE0").Int()
texture2d = contextPrototype.Get("TEXTURE_2D")
textureMagFilter = contextPrototype.Get("TEXTURE_MAG_FILTER")
textureMinFilter = contextPrototype.Get("TEXTURE_MIN_FILTER")
@@ -279,6 +282,12 @@ func (c *context) framebufferPixels(f *framebuffer, width, height int) ([]byte,
return jsutil.Uint8ArrayToSlice(p), nil
}
func (c *context) activeTexture(idx int) {
c.ensureGL()
gl := c.gl
gl.Call("activeTexture", texture0+idx)
}
func (c *context) bindTextureImpl(t textureNative) {
c.ensureGL()
gl := c.gl