Anti-Grain Geometry and other alternatives

707 views
Skip to first unread message

Tom Breloff

unread,
Sep 15, 2015, 12:01:37 PM9/15/15
to julia-users
Does anyone in the community have experience with Anti-Grain Geometry as an alternative to Cairo?  


I know very little about it, but it could possibly be faster and more stable than Cairo for 2D graphics, with a lighter dependency footprint.  It is a C++ package, so this is something that will depend on a stable Cxx.jl.

Are there any other similar frameworks that could be more performant than Cairo for intense 2D simulations and realtime plots?  I suppose OpenGL, although my experience with OpenGL is that it's hard to make the graphics pretty.  Thoughts?

Tim Holy

unread,
Sep 15, 2015, 1:05:11 PM9/15/15
to julia...@googlegroups.com
Daniel Jones has played a bit with Skia:
https://github.com/dcjones/Skia.jl/issues/1

Also C++, however.

Andreas Lobinger seems to have been playing with accelerated Cario drawing
(https://github.com/JuliaLang/Gtk.jl/pull/170#issuecomment-139213820), it
would be cool to hear more details about that.

--Tim

Simon Danisch

unread,
Sep 15, 2015, 3:08:10 PM9/15/15
to julia-users
I've looked at most techniques and settled for distancefield based techniques for OpenGL.
I'm in the middle of putting everything together but right now I've just finished support for different markers, styles (glow || outlined || filled) and full unicode rendering.
You can place and rotate them however you want ;)
Lines rendered with the same technique are mostly there. They'll support the same styles and stuff like dotted lines, etc.
To get an idea of how the technique compares to Agg and Skia you can look here: https://www.mapbox.com/blog/drawing-antialiased-lines/ (there is a graphic with exactly that comparison, WebGL is the technique I'm talking about).
What's missing with that approach is hinting and LCD aware anti aliasing. I've seen people add these techniques to distance field rendering pipelines, so I'm optimistique that we can add them later on when asked for.
So far I'm positively surprised by the quality. I've made some screenshot if you're interested: https://drive.google.com/folderview?id=0B9vNkD-OdlWNV3dCUWJyeTk3aDA&usp=sharing

The speed is top notch, giving me smooth rendering of 1 million static particles and 50 thousand animated particles on my pretty weak ultrabook (i3 with hd 4400 - 1 million particles render in roughly 0.03s)
It supports hit testing calculated on the GPU( exposed via Reactive). Any pixel on the screen can be traced back to its origin.
I've added quite a lot of support for selection and editing the data directly on the GPU, which enabled me to implement complex stuff like text editing and 3D gizmos.
I hope that I can release all this in roughly one week.

By the way, it's all written in Julia and OpenGL with very little dependencies ;)

Best,
Simon

Tom Breloff

unread,
Sep 15, 2015, 3:29:43 PM9/15/15
to julia-users
Simon: This all makes me really excited to try out.  Do you have a bare-minimum tutorial to do the basics in your package?  How should I learn it?

Simon Danisch

unread,
Sep 15, 2015, 4:40:27 PM9/15/15
to julia-users
Good question! Best would be to wait a little more. I plan to release a tutorial video, explaining all the new features. 
Don't expect something too polished, though. It's good to have the primitives working, but turning it into a well-rounded package will still require quite a bit of time.
I hope I can turn GLVisualize into a backend for Gadfly, to profit from Gadfly's rich functionality. That would leverage the 2D part a bit.
Daniel has done quite a bit of work to align everything nicely and make plots look great. I really don't want to duplicate that work ;)


Am Dienstag, 15. September 2015 18:01:37 UTC+2 schrieb Tom Breloff:

Tom Breloff

unread,
Sep 15, 2015, 5:03:01 PM9/15/15
to julia-users
Solid/fast basics are what's important.  I'll keep an eye out for your videos.

Tim Holy

unread,
Sep 15, 2015, 5:38:36 PM9/15/15
to julia...@googlegroups.com
I'm already shopping for an OpenGL-capable laptop, just so I can finally run
your code :-).

--Tim

Simon Danisch

unread,
Sep 15, 2015, 5:47:52 PM9/15/15
to julia-users
@Tim Holy, the wait has been long enough ;)
By the way, what graphic card do you have? 
It's quite possible that it works on windows without a new machine.
- given that this is an acceptable temporary solution for you :)

Am Dienstag, 15. September 2015 18:01:37 UTC+2 schrieb Tom Breloff:

Andreas Lobinger

unread,
Sep 16, 2015, 1:21:13 AM9/16/15
to julia-users
Hello colleague,


On Tuesday, September 15, 2015 at 6:01:37 PM UTC+2, Tom Breloff wrote:
Does anyone in the community have experience with Anti-Grain Geometry as an alternative to Cairo?  


I know very little about it, but it could possibly be faster and more stable than Cairo for 2D graphics, with a lighter dependency footprint.  It is a C++ package, so this is something that will depend on a stable Cxx.jl.

 Could you clarify what you mean with "more stable than Cairo for 2D graphics"?

Tom Breloff

unread,
Sep 16, 2015, 1:51:05 AM9/16/15
to julia-users
I've just seen so many core dumps that happen within Cairo over my career.  They may not be Cairo's fault, but I've just gotten it in my head that it can be a little unstable at times.  YMMV

Andreas Lobinger

unread,
Sep 16, 2015, 2:03:08 AM9/16/15
to julia-users
OK. My experience is a little bit different. One thing is, cairo is not very tolerant to pointer trouble. While other toolkits just silently discard uncorrect pointers, cairo complains.

Tom Breloff

unread,
Sep 16, 2015, 9:21:28 AM9/16/15
to julia...@googlegroups.com
It's very possible all the times Cairo crashed it was the cause of corrupted memory from something else... But of course not every library is so sensitive to that stuff. Either way don't read too much into it... it's just a vague impression I've built over the years.

Also, after comments from Simon, I'm even more excited about GLPlot/GLVisualize than I was before, and it will probably fill the needs nicely. (fingers crossed! :)
Reply all
Reply to author
Forward
0 new messages