最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Export Asymptote graph to WebGL - Stack Overflow

programmeradmin2浏览0评论

I have a Docker installation of Asymptote, based on Alpine Linux, the output of which I intend to transclude in web pages. The installed packages are g++ gettext-dev texlive-dev freetype-dev woff2-dev glm-dev asymptote asymptote-doc imagemagick; and dvisvgm is built from the source.

This setup successfully produces *.svg outputs for two-dimetional graphs (the command is /usr/bin/asy -q -V -offline --enable-offscreen -f svg -o output && cat output.svg; example).

However, I was unable to produce interactive three-fimentional graphs in WebGL, like this one.

The command /usr/bin/asy -q -offline -f html -o output && cat output.html does output an HTML file; but it is just a wrapped SVG file, which isn't even rendered correctly by the browser; and not an HTML file as in the example, drawing on canvas.

I suspect that my docker setup is unable to produce the desired output. It has no assess to a GPU, but I want to generate vector graphics, not to render it there.

There is no configuration file, other than set up by the Alpine package. docker exec -it asymptote /usr/bin/asy -version reports too many disabled features:

Asymptote version 2.91 [(C) 2004 Andy Hammerlindl, John C. Bowman, Tom Prince]

ENABLED OPTIONS:
threads  Render OpenGL in separate thread

DISABLED OPTIONS:
V3D      3D vector graphics output
WebGL    3D HTML rendering
OpenGL   3D OpenGL 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
Editline interactive editing (if Readline is unavailable)
Sigsegv  Distinguish stack overflows from segmentation faults
GC       Boehm garbage collector

Perhaps, it could be corrected by installing additional dependencies, or adding parameters to the asy command?

I have a Docker installation of Asymptote, based on Alpine Linux, the output of which I intend to transclude in web pages. The installed packages are g++ gettext-dev texlive-dev freetype-dev woff2-dev glm-dev asymptote asymptote-doc imagemagick; and dvisvgm is built from the source.

This setup successfully produces *.svg outputs for two-dimetional graphs (the command is /usr/bin/asy -q -V -offline --enable-offscreen -f svg -o output && cat output.svg; example).

However, I was unable to produce interactive three-fimentional graphs in WebGL, like this one.

The command /usr/bin/asy -q -offline -f html -o output && cat output.html does output an HTML file; but it is just a wrapped SVG file, which isn't even rendered correctly by the browser; and not an HTML file as in the example, drawing on canvas.

I suspect that my docker setup is unable to produce the desired output. It has no assess to a GPU, but I want to generate vector graphics, not to render it there.

There is no configuration file, other than set up by the Alpine package. docker exec -it asymptote /usr/bin/asy -version reports too many disabled features:

Asymptote version 2.91 [(C) 2004 Andy Hammerlindl, John C. Bowman, Tom Prince]

ENABLED OPTIONS:
threads  Render OpenGL in separate thread

DISABLED OPTIONS:
V3D      3D vector graphics output
WebGL    3D HTML rendering
OpenGL   3D OpenGL 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
Editline interactive editing (if Readline is unavailable)
Sigsegv  Distinguish stack overflows from segmentation faults
GC       Boehm garbage collector

Perhaps, it could be corrected by installing additional dependencies, or adding parameters to the asy command?

Share Improve this question edited Mar 22 at 17:08 Alexander Mashin asked Mar 19 at 8:21 Alexander MashinAlexander Mashin 4,6141 gold badge10 silver badges20 bronze badges 12
  • you clearly output html file. what makes you think it should be interactive? – iam_ai_copy-paste Commented Mar 20 at 2:43
  • Comparison to the examples at Asymptote site. There's a different kind of HTML. – Alexander Mashin Commented Mar 20 at 11:18
  • and they produced the examples with the same command as yours? – iam_ai_copy-paste Commented Mar 20 at 13:57
  • I cannot be sure; perhaps, I should change mine. If only I knew, how. – Alexander Mashin Commented Mar 20 at 14:20
  • i mark this question as a typo. you are not sure what your command does. with that you proceed to compare its output to some "online examples". i think you need to rephrase a question. better to make new one. – iam_ai_copy-paste Commented Mar 21 at 2:43
 |  Show 7 more comments

1 Answer 1

Reset to default 0

I managed to achieve what I wanted—WebGL output wrapped in HTML—by building Asymptote from source with ./configure && make && make install.

The packages that I installed before building were: coreutils flex bison cmake g++ gcc libtool musl-dev make automake autoconf ncurses-dev libtirpc-dev freeglut-dev glm-dev fftw-dev eigen-dev gsl-dev curl-dev gettext-dev texlive-dev texmf-dist-latexextra freetype-dev woff2-dev imagemagick (I admit that few of these packages could be redundant). I also built dvisvgm from source.

After that, the output of docker exec -it asymptote /usr/bin/asy -version became:

ENABLED OPTIONS:
V3D      3D vector graphics output
WebGL    3D HTML rendering
OpenGL   3D OpenGL 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
GC       Boehm garbage collector
threads  Render OpenGL in separate thread

DISABLED OPTIONS:
LSP      Language Server Protocol
Readline Interactive history and editing
Editline interactive editing (Readline is unavailable)
Sigsegv  Distinguish stack overflows from segmentation faults

and the /usr/bin/asy -q -f html -o output && cat output.html started to produce an HTML file similar to 3D examples at Asymptote site.

发布评论

评论列表(0)

  1. 暂无评论