Skip to content
/ webgl Public
forked from gopherjs/webgl

Gopherjs binding to the webgl context

License

Notifications You must be signed in to change notification settings

n2d/webgl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

webgl

GoDoc Go Report Card

change from https://godoc.org/github.com/gopherjs/webgl support "syscall/js"

Example

Screenshot

webgl_example.go:

package main

import (
	"syscall/js"
	"github.com/n2d/webgl"
)

func main() {
	var canvas js.Value = js.
		Global().
		Get("document").
		Call("getElementById", "canvas")


	canvas.Set("height", 600)
	canvas.Set("width", 800)

	gl, _ := webgl.NewContext(canvas)

	gl.ClearColor(1, 0, 0, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT)
}

webgl_example.html:

<html><body><script src="webgl_example.js"></script><canvas id='canvas'></canvas></br></body></html>

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

About

Gopherjs binding to the webgl context

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%