Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

28 Commits

Repository files navigation

webgl

GoDocGo Report Card

GopherJS bindings for WebGL 1.0 context.

Example

Screenshot

webgl_example.go:

package main
import (
"github.com/gopherjs/gopherjs/js""github.com/gopherjs/webgl"
)
funcmain() {
document:=js.Global.Get("document")
canvas:=document.Call("createElement", "canvas")
document.Get("body").Call("appendChild", canvas)
attrs:=webgl.DefaultAttributes()
attrs.Alpha=falsegl, err:=webgl.NewContext(canvas, attrs)
iferr!=nil {
js.Global.Call("alert", "Error: "+err.Error())
}
gl.ClearColor(0.8, 0.3, 0.01, 1)
gl.Clear(gl.COLOR_BUFFER_BIT)
}

webgl_example.html:

<html><body><scriptsrc="webgl_example.js"></script></body></html>

To produce webgl_example.js file, run gopherjs build webgl_example.go.

About

Gopherjs binding to the webgl context

Resources

Stars

112 stars

Watchers

13 watching

Forks

Releases

Packages

Contributors

Languages