opengl: Remove init (JavaScript)

This commit is contained in:
Hajime Hoshi 2016-07-04 00:55:04 +09:00
parent 0d91883fb9
commit 6cfb92c4c4

View File

@ -108,25 +108,11 @@ func NewContext() (*Context, error) {
webglContext := js.Global.Call("require", "gl").Invoke(16, 16, options) webglContext := js.Global.Call("require", "gl").Invoke(16, 16, options)
gl = &webgl.Context{Object: webglContext} gl = &webgl.Context{Object: webglContext}
} }
c := &Context{}
c := &Context{
locationCache: newLocationCache(),
lastCompositeMode: CompositeModeUnknown,
}
c.gl = gl c.gl = gl
c.init()
return c, nil return c, nil
} }
func (c *Context) init() {
gl := c.gl
// Textures' pixel formats are alpha premultiplied.
gl.Enable(gl.BLEND)
c.BlendFunc(CompositeModeSourceOver)
f := gl.GetParameter(gl.FRAMEBUFFER_BINDING)
c.screenFramebuffer = Framebuffer{f}
}
func (c *Context) Reset() error { func (c *Context) Reset() error {
c.locationCache = newLocationCache() c.locationCache = newLocationCache()
c.lastFramebuffer = invalidFramebuffer c.lastFramebuffer = invalidFramebuffer