示例#1
0
文件: main.go 项目: andrebq/exp
func main() {
	w, err := opala.NewDisplay(800, 600, "simple")
	if err != nil {
		panic(err)
	}

	// this create a new atlas that can later be used
	// to render images on the screen.
	backgroundLayer := opala.NewAtlas(800, 600, 1, 1)
	img, _ := backgroundLayer.AllocateDefault("img")
	pngfile := gas.MustAbs("github.com/andrebq/exp/opala/testdata/simple/f.png")
	_ = pngfile
	//img.FromPNG(gas.MustAbs(pngfile))
	img.Fill(color.RGBA{255, 0, 255, 255})

	dl := opala.NewDisplayList()
	dl.Push(w)
	opala.Vsync(true)
	for !dl.ShouldClose() {
		opala.AcquireInput()
		w.SendDraw(opala.ClearCmd{})
		w.SendDraw(&opala.DrawImage{
			Image: img,
		})
		w.Render()
	}
}
示例#2
0
文件: webui.go 项目: andrebq/exp
func (h *Handler) DefaultStatic() *Handler {
	h.Static = http.FileServer(http.Dir(gas.MustAbs("github.com/andrebq/exp/pandora/webui/static")))
	return h
}
示例#3
0
文件: main.go 项目: andrebq/exp
	glProg.Link()

	if glProg.Get(gl.LINK_STATUS) != gl.TRUE {
		defer vertexShader.Delete()
		defer fragShader.Delete()
		return glProg, fmt.Errorf("Unable to link glProg. Cause: %v", glProg.GetInfoLog())
	}
	glProg.Use()

	return
}

var (
	theTriangleBuf *glh.MeshBuffer
	shaderDir      = gas.MustAbs("github.com/andrebq/exp/gui")
)

func updateScene(dt float64) {
}

func prepareScene() {
	theTriangleBuf = glh.NewMeshBuffer(
		glh.RenderArrays,

		glh.NewIndexAttr(1, gl.UNSIGNED_INT, gl.STATIC_DRAW),
		glh.NewPositionAttr(3, gl.FLOAT, gl.STATIC_DRAW),
	)
	theTriangleBuf.Add(triangleIdx, triangleVertex)
}