devops 信创在数字经济时代提升企业竞争力的关键策略
758
2022-10-27
Ink 是基于OpenGL的Go 2D图形创意框架
Ink is a framework for creative 2D graphics in Go, based on OpenGL. Visit buchanae.github.io/ink for more.
Example: a simple triangle
Install:
go get github.com/buchanae/ink
(Building Ink is a little tricky, because it depends on GLFW. You might need to install build-essential, xorg-dev, libgflw3-dev, etc).
Write example.go:
package mainimport ( "github.com/buchanae/ink/app" . "github.com/buchanae/ink/color" . "github.com/buchanae/ink/dd" "github.com/buchanae/ink/gfx")func Ink(doc *app.Doc) { t := Triangle{ XY{0.2, 0.2}, XY{0.8, 0.2}, XY{0.5, 0.8}, } s := gfx.NewShader(t) s.Set("a_color", []RGBA{ Red, Green, Blue, }) s.Draw(doc)}
Run:
ink example.go
Ink opens a window and renders your triangle:
There are more examples in the sketches directory.
Implementation Notes
Currently, Ink is based on OpenGL only, although other backends are desired. Ink is also focused primarily on 2D graphics so far, because everything is simpler in two dimensions, although I'd like to extend it to 3D some day.
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~