func (self *TextureManager) loadTexture(filename string, setup TexSetup) (*Texture, error) { // runtime.LockOSThread() f, er := os.Open(filename) if er != nil { return nil, er } defer f.Close() img, er := png.Decode(f) if er != nil { return nil, er } bytes := getByteArray(img) width, height := img.Bounds().Max.X, img.Bounds().Max.Y t := gl.GenTexture() texture := &Texture{t, filename, width, height, setup} texture.LoadData(bytes) texture.setupParams() return texture, nil }
func (self *TextureManager) CreateEmptyTexture(name string, width, height int, setup TexSetup) *Texture { t := gl.GenTexture() texture := &Texture{t, name, width, height, setup} texture.LoadData(nil) texture.setupParams() return texture }