A pure-Go GPU-accelerated 2D graphics library

4,782 views
Skip to first unread message

Hai Thanh Nguyen

unread,
Jan 12, 2014, 2:42:11 PM1/12/14
to golan...@googlegroups.com
Looks like the only notable pure-go 2D graphics library we currently have is draw2d, we cannot be satisfied.
I want a graphics library like Skia, that is really good, something that has a usable, clean, friendly API and really support OpenGL. (draw2d has opengl port but it's mediorce and doesn't even work well)
2D graphics can be drawn with OpenGL shader, taking advantage of the GPU, being resolution-independent and hardware-accelerated. It brings serious performance improvement, not small at all (see this http://www.mdk.org.pl/2007/8/16/vector-drawing-opengl-polygon-tessellation), this is significant especially for mobile devices.
Many libraries has been moving to that path, one of the most famous, Skia, has already been ported and being used for hardware acceleration in Chrome. Jogl (Java) also implemented it (http://ramisantina.com/blog/2011/04/gpu-based-resolution-independent-font-curve-rendering-initial-release/).
The technique is really impressive and I really want to make something like that in Go, it will be a great base for projects like UI toolkit or any kind of visualization. The "how to do it" is already available, there are papers, blog posts and real code describing and implementing it, the problem is just how to understand. An impressive list of references here https://github.com/openframeworks/openFrameworks/issues/1190.
What do you think? Anyone want to help?

bja...@gmail.com

unread,
Aug 17, 2014, 4:18:40 PM8/17/14
to golan...@googlegroups.com
I'm looking for such a library as well. I've been attempting to write Skia bindings for Go, but hitting lots of resistance.
If anyone comes across anything let me know. Or if you have the expertise to get things started, I would love to contribute.

-Bryan

Hai Thanh Nguyen

unread,
Aug 17, 2014, 9:08:34 PM8/17/14
to bja...@gmail.com, golan...@googlegroups.com
I'm curious about what you're working on, are you trying to make a GUI library? You did exactly what I did in the past with regards to Skia, also started with wrapping Skia, wrote some functionalities on top of it with Go, dealt with all the "main thread" silliness, then I decided to make a library of my own, I did the work here https://github.com/phaikawl/gosgl. Actually I sort of abandoned the project by now. It's too much work and just not enough manpower for it.


--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/QZkJHTBgFlc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mikael Gustavsson

unread,
Aug 18, 2014, 8:43:12 AM8/18/14
to golan...@googlegroups.com
If I allow myself some wishful thinking, I think a go port of https://github.com/memononen/nanovg would be a very cool thing to have.

ajstarks

unread,
Aug 18, 2014, 10:56:53 AM8/18/14
to golan...@googlegroups.com
For what it's worth, this OpenVG library [1, 2, 3], is not pure Go (it wraps the GPU-accelerated C library), but it provides a high-level 2D API for Go programs.



On Sunday, January 12, 2014 2:42:11 PM UTC-5, Hai Thanh Nguyen wrote:

bja...@gmail.com

unread,
Aug 18, 2014, 12:08:24 PM8/18/14
to golan...@googlegroups.com, bja...@gmail.com
I intend to build an app that has a lot of things happening on different go routines and will send it all to a single go routine that does the drawing. Obviously go's concurrency + hardware accelerated UI seem like the perfect fit. I started by picking up some opengl knowledge but I was happy to see Skia was already doing what I was looking to do.

I'm on the brink of giving up on Skia, because I can't even get a hello world example running. The way it is written makes it difficult to use even in C++. Go bindings will probably make it much worse.

I might just use draw2d just to get it out there and clean up performance later. On the other hand using shaders does sound quite appealing for the sheer performance. I might end up doing something similar to what you did. I am only going to need a few primitive shapes to get started.

-Bryan

Hai Thanh Nguyen

unread,
Aug 19, 2014, 12:48:04 AM8/19/14
to Bryan Austin, golan...@googlegroups.com
My advice is to just use nanovg (https://github.com/memononen/nanovg), it's small and it's good enough.
If you feel nanovg is not enough, you should try again to wrap Skia, after solving all the main thread silliness with Russ Cox's technique, I managed to get it to work well, no real problem anymore and could actually develop on it. Honestly my decision to write a new lib was just because Skia is too big and messy, I wanted to make some cool and new, NIH syndrome or too much Go fanboyism, mainly Go fanboyism actually.

Bryan Austin

unread,
Aug 19, 2014, 7:54:23 AM8/19/14
to Hai Thanh Nguyen, golan...@googlegroups.com
Do you have your skia bindings available somewhere?
-Bryan

Hai Thanh Nguyen

unread,
Aug 19, 2014, 8:39:53 AM8/19/14
to Bryan Austin, golan...@googlegroups.com
My old project is here: https://github.com/phaikawl/Skia-Go-Renderer and https://github.com/phaikawl/gosui. I'm not sure if they've been updated to the latest code, and it's likely that they wouldn't even work (it's 8 months already, time so fast).

a.ko...@gmail.com

unread,
Dec 18, 2025, 4:38:54 PM (15 hours ago) Dec 18
to golang-nuts
A 2025 update: Go now has its own professional graphics ecosystem, GoGPU. Readiness: Rapid Development Phase. https://github.com/gogpu.
Reply all
Reply to author
Forward
0 new messages