Had some recent struggles to get asymptote
to render 3D graphics on either my office desktop or on my Chromebook.
After some digging I found the culprit: the mesa
driver.
My office desktop is a bit ancient by this point, and has two graphics cards installed to support a dual-screen setup.
This has already caused me a lot of grief. But only recently did it propagate to also affecting asymptote
.
Similarly, my ArchLinux installation inside Crostini on my Chromebook doesn't have a "real" graphics card, it running inside a virtual machine and all.
On both computers, recently when I try running asy
(version 2.86) to render a 3D scene, I end up with the error
Error initializing offscreen context: Depth=0
In both cases asy
works after switching to using a software driver.
This can be accomplished by setting the environmental variables
LIBGL_ALWAYS_SOFTWARE=true
and
GALLIUM_DRIVER=softpipe
(there are other software rasterers included in mesa
, but softpipe
was the only one I've found to work. llvmpipe
and swrast
both crashes for some reason.)
A possibly related issue is that the output files contain rendering artifacts (in my case, a significant part of the output is "missing").
While I am not sure whether this has to do with the driver per se, a work around is to issue -render 0
to asy
.