Esempio n. 1
0
func setResolution(
	gl *webgl.Context, canvas *js.Object, uResolution *js.Object) {
	width := canvas.Get("clientWidth").Int()
	height := canvas.Get("clientHeight").Int()

	if (canvas.Get("width").Int() != width) ||
		(canvas.Get("height").Int() != height) {
		canvas.Set("width", width)
		canvas.Set("height", height)
	}
	gl.Viewport(0, 0, width, height)
	gl.Uniform2f(uResolution, float32(width), float32(height))
}