メインコンテンツに移動

自家ビルドParaView

どうもこう, ScreenShotしか保存できないのが, どうしても困る.自家ビルドして, 解決できないのか, 探ってみる.

結論的にいうと, ParaView Version 4.4まではGL2PSでベクトル出力できたが,現在,OpenGL2とかに対応したので,不可能になっているのではないか?ということみたいだ.

KitWareの言い訳を発見した:

Vector graphics output, especially for 3D geometry, is in pretty sorry shape since the switch to OpenGL2. This is because of the exporter’s reliance on the GL2PS library, which uses deprecated functionality (specifically, OpenGL feedback buffers) that aren’t available in newer versions of OpenGL.

なるほど.GL2PSというのはOpenGL2で廃止された機能を使っているわけだ.

In particular, this means that all 3D geometry will be rasterized, unfortunately, as this is the only way to easily get the rendered primitives into the output at all. There is an option of using OpenGL TransformFeedback[1] to capture this geometry and inject it into GL2PS manually using the gl2psAddPolyPrimitive function[2], but this will require significant effort and funding to implement this into the OpenGL2 mappers.

ううむ,たしかに全部ビットマップになってしまいます.回避策もあるけど,ほとんど無理ゲーってわけか.

One idea I’ve had is to move away from GL2PS and add a new renderer that manually translates a 3D scene into Context2D primitives so we could pipe these into one of the Context2D-specific vector exporters, vtkPDFExporter[3] and vtkSVGExporter[4]. These provide a higher quality output than GL2PS, as they can take advantage of format-specific features that get lost in the GL2PS abstraction. This would also take significant effort, but it would remove the reliance on external libraries.

お,おう.GL2PSは諦めて,Context2Dとかをつかえってか?で,苦労はするけどVTKの機能でなんとかできるってわけだ.で・・・その,Context2Dって,なんですかね.

I agree that it’d be great to see this functionality improved in ParaView, but it’s going to be a significant undertaking and AFAIK our existing funding sources haven’t requested that we spend time on it.

なるほど.KitWareの出資者が,ベクトルグラフィックスに興味がないわけですか.仕方ありませんねえ・・・

まあビットマップだとGPU機能で表示できるけど,ベクトル表示しようとすると,ほれ.全然違う.Zバッファとか使えないわけで,現代のスマホとかの機能とは違うところにある.ので,ねぐられちまったわけだ.

ぢゃ,自家ビルドするだけ時間の無駄じゃないか・・・

基本のビルド

いろいろ必要であるそうだ.

  • cmake が必要である. 動作確認しておく:
$ cmake --version
cmake version 3.21.3
  • Qt5 が必要である. 動作確認しておく:
$ qmake --version
QMake version 3.1
Using Qt version 5.12.11 in /opt/Qt/5.12.11/clang_64/lib
  • ffmpegライブラリーをインストールしておくと, 動画を作成できるらしいが,まあええわ.
  • MESA 3Dライブラリーをインストールしておくと, 描画サーバーがOpenGLライブラリーを持っていなかった場合にも対応できるようになるらしいが,まあええわ.
  • PostScript/PDF/SVGの出力には, GL2PSが必要である.

ダウンロードしてみる.

arm64$ git clone https://gitlab.kitware.com/paraview/paraview.git
arm64$ cd paraview
arm64$ git submodule update --init --recursive

ビルドは他所で行えということなので, 他所でやる.

X86ビルド

現状配布されているQtはX86でビルドされているので,ダウンロードバージョンのQtであると,これしか方法がない.これを使ってX86ビルドする.

x86_64$ cd ..
x86_64$ mkdir paraview.mac
x86_64$ cd paraview.mac
x86_64$ cmake ../paraview
...
-- Enabled modules: VTK(148), ParaView(39 + 3)
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sugimoto/Documents/Source/Free/paraview.mac

とりま, 準備はできたみたいね.ここでccmakeを動かさないとダメである

ほんで

x86_64$ make
...
[100%] Linking CXX executable ../../bin/paraview.app/Contents/MacOS/paraview
[100%] Built target paraview

できた. paraview.mac/bin/paraview.app をクリックすると, 起動しやがったぞ

a

QtをARM64でビルド