vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
560 stars 94 forks source link

Problems with settings.render = 10; #472

Closed rafelamer closed 2 months ago

rafelamer commented 2 months ago

Hi!,

I'm running asymptote in Fedora 40 and the version is

~$ asy --version
Asymptote version 2.86 [(C) 2004 Andy Hammerlindl, John C. Bowman, Tom Prince]

ENABLED OPTIONS:
V3D      3D vector graphics output
WebGL    3D HTML rendering
OpenGL   3D OSMesa offscreen rendering
SSBO     GLSL shader storage buffer objects
GSL      GNU Scientific Library (special functions)
FFTW3    Fast Fourier transforms
Eigen    Eigenvalue library
XDR      External Data Representation (portable binary file format for V3D)
CURL     URL support
LSP      Language Server Protocol
Readline Interactive history and editing
Sigsegv  Distinguish stack overflows from segmentation faults
GC       Boehm garbage collector
threads  Render OpenGL in separate thread

DISABLED OPTIONS:

The file ellipoid.asy contains the code

import solids;
import graph3;

settings.tex = 'pdflatex';
settings.outformat = 'pdf';
settings.prc = false;
settings.render = 10;

size(16cm,0);
currentprojection=orthographic(16,9,2.5);

real a = 10,
     b = 6;

limits((0,0,0),(20,20,20));
draw((-14,0,0)--(14,0,0),red+linewidth(0.3mm),Arrow3(5));
draw((0,-14,0)--(0,14,0),red+linewidth(0.3mm),Arrow3(5));
draw((0,0,-8)--(0,0,8),red+linewidth(0.3mm),Arrow3(5));

surface ellipsoid = scale(b,a,b) * unitsphere;
draw(surface(ellipsoid), opacity(0.3)+lightgreen);

When I run

~$ asy -f pdf ellipsoid.asy

I get the error Error initializing offscreen context: Depth=0 and no PDF is generated.

Some months ago, the pdf was generated correctly.

If I substitute settings.render = 10; by settings.render = 0;, the PDF is generated, bue the result is ugly.

Do you know how to solve the problem?

With the version 2.91 downloaded from https://sourceforge.net/projects/asymptote/ it works fine

Thanks.

Best regards,

Rafel Amer

johncbowman commented 2 months ago

There are 2 problems: you are using an obsolete version of Asymptote (which misses an update to offscreen rendering introduced in version 2.87) and it was configured with the -offscreen option, which is only intended for headless machines (no GPU card), not for normal interactive use:

OpenGL 3D OSMesa offscreen rendering

You should install the latest version of Asymptote, 2.91, and configure without the --enable-offscreen option (see the file INSTALL for compilation instructions). Also be aware that using -render=10 creates a huge PDF file: a 1 bp x 1bp region gets rendered to a 10 pixel x10 pixel region, so that, on accounting for an antialiasing factor of 2, your example renders to a 9100x5920 image. Is that really what you intended? Usually -render=4 is sufficient.