예제 #1
0
func (env *Environment) LoadGlyphs(ctx gl.Context) {
	src, _, err := image.Decode(glutil.MustOpen("material/glyphs.png"))
	if err != nil {
		log.Fatal(err)
	}
	env.glyphs.Create(ctx)
	env.glyphs.Bind(ctx, nearestFilter, DefaultWrap)
	env.glyphs.Update(ctx, 0, text.TextureSize, text.TextureSize, src.(*image.NRGBA).Pix)
}
예제 #2
0
func (env *Environment) LoadIcons(ctx gl.Context) {
	src, _, err := image.Decode(glutil.MustOpen("material-icons-black-mdpi.png"))
	if err != nil {
		log.Fatal(err)
	}

	r := image.Rect(0, 0, 2048, 2048)
	dst := image.NewNRGBA(r)
	// pt := image.Point{0, -(2048 - src.Bounds().Size().Y)}
	draw.Draw(dst, r, src, image.ZP, draw.Src)

	// f, _ := os.Create("debug-icons.png")
	// png.Encode(f, dst)

	env.icons.Create(ctx)
	env.icons.Bind(ctx, DefaultFilter, DefaultWrap)
	env.icons.Update(ctx, 2048, 2048, dst.Pix)
}