12
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

openFrameworksをサクラVPSで動かす

Last updated at Posted at 2016-03-10

とある案件でサーバサイドでイメージレンダリングする必要があったのでここにメモ。
本番ではさくらクラウドのインスタンスを使った。

前提条件

サクラVPS OS Ubuntu 14.04

下準備

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install pkg-config

o/Fインストール

linux版のoFをDLしてきて解凍。

$ wget http://www.openframeworks.cc/versions/v0.9.2/of_v0.9.2_linux64_release.tar.gz
$ tar zxvf of_v0.9.2_linux64_release.tar.gz

o/Fには各プラットフォームのインストール用のスクリプトが用意されているのでそれを使う。
今回はubuntu環境なのでlinux/ubuntuのスクリプトを使ってインストール。

$ cd of_v0.8.4_linux64_release/scripts/linux/ubuntu
$ sudo ./install_codeblocks.sh
$ sudo ./install_dependencies.sh

仮想ディスプレイ

当たり前だがサーバマシンにはディスプレイが繋がっていないのでopenglのコンテキストが作れない。oFのコンパイルはできてもランタイムでエラーするのが問題だった。そこで仮想ディスプレイを用意する。

xvfbで仮想ディスプレイを作成

$ sudo apt-get install xvfb
$ Xvfb :1 -screen 0 1024x768x24 -nolisten tcp &

これで準備は完了。あとはプロジェクトを作ってmakeでビルドする。

実行

実行する時DISPLAY環境変数を与えて実行。

$ DISPLAY=:1 <Your App>

リモートで確認

肉眼で描画されてる様子を見たいならx11xncでvncを立ててリモートから接続しながら実行。

$ x11vnc -listen 0.0.0.0 -rfbport 5900 -noipv6 -passwd password -display :1 -forever &

以上。

12
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?