func WindowToProj(x, y int) (float64, float64) {
	var projmat, modelmat [16]float64
	var viewport [4]int32
	gl.GetDoublev(gl.PROJECTION_MATRIX, projmat[:])
	gl.GetDoublev(gl.MODELVIEW_MATRIX, modelmat[:])
	gl.GetIntegerv(gl.VIEWPORT, viewport[:])
	y = int(viewport[3]) - y
	px, py, _ := glu.UnProject(float64(x), float64(y), 0,
		&modelmat, &projmat, &viewport)
	return px, py
}
Returns x, y in window co-ordinates at 0 in the z direction
package glh
import (
	"image"
	"image/color"
	"image/png"
	"log"
	"os"
	"unsafe"
	"github.com/go-gl/gl"
	"github.com/go-gl/glu"
)
func Sizeof(gtype gl.GLenum) uint {
	switch gtype {
	case gl.BOOL:
		var v gl.GLboolean
		return uint(unsafe.Sizeof(v))
	case gl.BYTE:
		var v gl.GLbyte
		return uint(unsafe.Sizeof(v))
	case gl.UNSIGNED_BYTE:
		var v gl.GLubyte
		return uint(unsafe.Sizeof(v))
	case gl.SHORT:
		var v gl.GLshort
		return uint(unsafe.Sizeof(v))
	case gl.UNSIGNED_SHORT:
		var v gl.GLushort
		return uint(unsafe.Sizeof(v))
	case gl.INT:
		var v gl.GLint
		return uint(unsafe.Sizeof(v))
	case gl.UNSIGNED_INT:
		var v gl.GLuint
		return uint(unsafe.Sizeof(v))
	case gl.FLOAT:
		var v gl.GLfloat
		return uint(unsafe.Sizeof(v))
	case gl.DOUBLE:
		var v gl.GLdouble
		return uint(unsafe.Sizeof(v))
	}
	panic("Unsupported type")
}
func OpenGLSentinel() func() {
	check := func() {
		e := gl.GetError()
		if e != gl.NO_ERROR {
			s, err := glu.ErrorString(e)
			if err != nil {
				log.Panic("Invalid error code: ", err)
			}
			log.Panic("Encountered GLError: ", e, " = ", s)
		}
	}
	check()
	return check
}
func GetViewportWH() (int, int) {
	var viewport [4]int32
	gl.GetIntegerv(gl.VIEWPORT, viewport[:])
	return int(viewport[2]), int(viewport[3])
}
func GetViewportWHD() (float64, float64) {
	w, h := GetViewportWH()
	return float64(w), float64(h)
}