<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8997670151541573613</id><updated>2026-07-25T08:57:55.013+09:00</updated><category term="renderer"/><category term="OpenGL"/><category term="glfw"/><category term="日本語訳"/><category term="xcode"/><category term="unity"/><category term="MMD"/><category term="bitbucket"/><category term="dev"/><category term="gdata"/><category term="git"/><category term="iOS"/><category term="oculus"/><category term="tutorial"/><category term="vc2013"/><category term="youtube"/><title type='text'>CSL::DevLog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-3270300258320059382</id><published>2016-10-08T07:39:00.000+09:00</published><updated>2016-10-08T08:01:37.662+09:00</updated><title type='text'>xcode8でdoxygen commentのwarningが出る問題の回避策</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
最近xcode8にアップデートしましたが，glfw3のプロジェクトを作っていたら大量の警告が発生しました．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;Documentation Issue Group&lt;/span&gt;&amp;nbsp;&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/usr/local/include/GLFW/glfw3.h:744:8: Empty paragraph passed to &#39;@sa&#39; command&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/main.cpp:12:10: In file included from /User&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;/main.cpp:12:&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
どうやらdoxygenコメントに不備があると，警告を出すようになったみたいですね．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
暫定的に，次のように警告を抑制することで回避しました．&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;#pragma clang diagnostic push&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;#pragma clang diagnostic ignored &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-Wdocumentation&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;s3&quot;&gt;#include &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;lt;GLFW/glfw3.h&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;s1&quot;&gt;#pragma clang pop&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
外部ライブラリのヘッダではでないように設定したいですね；&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/3270300258320059382/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2016/10/xcode8doxygen-commentwarning.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/3270300258320059382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/3270300258320059382'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2016/10/xcode8doxygen-commentwarning.html' title='xcode8でdoxygen commentのwarningが出る問題の回避策'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-6665920210905392418</id><published>2016-02-07T12:53:00.001+09:00</published><updated>2016-02-07T13:18:28.133+09:00</updated><title type='text'>開発環境構築 Win7 x64</title><content type='html'>&lt;h2&gt;
Windows の開発環境構築&lt;/h2&gt;
&lt;h3&gt;
インストールするもの&lt;/h3&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Atom&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;GLSL Preview&lt;/li&gt;
&lt;li&gt;atom-typescript&lt;/li&gt;
&lt;li&gt;autocomplete-webgl&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;VirtualBox&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vagrantup.com/downloads.html&quot;&gt;Vagrant&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;vagrant init bent/centos-6.7&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Visual Studio Community 2015&lt;/li&gt;
&lt;li&gt;Visual Studio Code&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.typescriptlang.org/&quot;&gt;TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://yebisuya.dip.jp/Software/PuTTY/&quot;&gt;Putty&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;UTF-8&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;a href=&quot;https://winscp.net/eng/download.php&quot;&gt;WinSCP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h3&gt;
トラブル対応&lt;/h3&gt;
&lt;h4&gt;
Vagrantの共有フォルダが参照できない&lt;/h4&gt;
&lt;div&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #444444; font-size: x-small;&quot;&gt;==&amp;gt; default: Mounting shared folders...
    default: /vagrant =&amp;gt; D:/Vagrant/mycentos
Failed to mount folders in Linux guest. This is usually because
the &quot;vboxsf&quot; file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`
vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the last command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device&lt;/span&gt;
&lt;/span&gt;
&lt;/pre&gt;
こんな風にマウント失敗のエラーが出ていた．&lt;br /&gt;
どうもVirtualBoxのGuestAdditionsがおかしくなっているようなので，次の対応を実施：&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;稼働OSを停止：&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;vagrant halt&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;プラグインインストール： vagrant plugin install vagrant-vbguest&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;d:\Vagrant\mycentos&amp;gt;vagrant plugin install vagrant-vbguest&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;Installing the &#39;vagrant-vbguest&#39; plugin. This can take a few minutes...&lt;/span&gt;&lt;span style=&quot;color: #444444; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;Installed the plugin &#39;vagrant-vbguest (0.11.0)&#39;!&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;再起動する途中でインストールされる： vagrant up&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
References&lt;/h3&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;http://dotinstall.com/lessons/basic_localdev_win/&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/6665920210905392418/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2016/02/win7-x64.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/6665920210905392418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/6665920210905392418'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2016/02/win7-x64.html' title='開発環境構築 Win7 x64'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-7908165352763106262</id><published>2015-12-16T23:33:00.001+09:00</published><updated>2015-12-16T23:33:35.295+09:00</updated><title type='text'>VirtualBoxにUbuntuをインストールしてnode.jsを立ち上げるまでのメモ</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
所要でubuntuを使いたくなったので，VirutalBoxで環境を整えます．&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
環境&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Win7 Pro 64bit&lt;/li&gt;
&lt;li&gt;CPU i7-6700&lt;/li&gt;
&lt;li&gt;MEM 16GB (pc3-12800)&lt;/li&gt;
&lt;li&gt;GPU GeForce970&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
手順&lt;/h2&gt;
&lt;br /&gt;
&lt;h3&gt;
1. VirutalBoxをインストール&lt;/h3&gt;
ここから． &lt;a href=&quot;https://www.virtualbox.org/wiki/Downloads&quot;&gt;https://www.virtualbox.org/wiki/Downloads&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&amp;gt;&amp;nbsp;&lt;/span&gt;VirtualBox 5.0.10 for Windows hosts&lt;br /&gt;
と&lt;br /&gt;
&amp;gt;&amp;nbsp;VirtualBox 5.0.10 Oracle VM VirtualBox Extension Pack  All supported platforms&lt;br /&gt;
の両方をダウンロード．&lt;br /&gt;
前者はVirtualBox本体．後者は物理的なPCのデバイスサポートみたいなイメージ．（&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , &amp;quot;bitstream vera sans&amp;quot; , sans-serif; font-size: 13px;&quot;&gt;Support for USB 2.0 and USB 3.0 devices, VirtualBox RDP and PXE boot for Intel cards.&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;verdana&amp;quot; , &amp;quot;bitstream vera sans&amp;quot; , sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;）&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
VirtualBox-5.X.XX-XXXXX-Win.exeを実行して，デフォルトでインストール．&lt;br /&gt;
起動だけ確認して一旦終了．&lt;br /&gt;
# 日本語化されているんですね．少し驚き．&lt;br /&gt;
&lt;br /&gt;
続いて，&lt;br /&gt;
Oracle_VM_VirtualBox_Extension_Pack-5.0.10-104061.vbox-extpackをダブルクリックするとVirtualBoxが起動され，「機能拡張パッケージをインストールする？」と聞かれるのでダイアログにしたがって進める．&lt;br /&gt;
「インストールに成功しました」などとダイアログが出ればOK．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
2. VirtualBoxにubuntuをインストール&lt;/h3&gt;
ubuntuのISOイメージからインストールする手段もありますが，&lt;br /&gt;
ubuntu JapaneseTeamで仮想ハードディスクイメージが公開されているので，それを使います．&lt;br /&gt;
（少しバージョンが古いですが）&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://www.ubuntulinux.jp/download/ja-remix-vhd&quot;&gt;https://www.ubuntulinux.jp/download/ja-remix-vhd&lt;/a&gt;&amp;nbsp;から，「Ubuntu 14.04 LTS - 2019年4月までサポート」にある「ubuntu-ja-14.04-desktop-amd64-vhd.zip 」&lt;br /&gt;
&lt;br /&gt;
手順もそこにある通りだが，linux 32bitしかメニューから選択でてきませんでした．&lt;br /&gt;
BIOSが怪しいのかな？と思いましたが，一旦windowsを再起動したら，出てくるようになりました（謎）．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ハードディスクで「すでにある仮想ハードディスクファイルを使用する」から，先ほどダウンロードしたZIP，を解凍して作成されたvhdファイルを指定．（100GB指定）&lt;br /&gt;
&lt;br /&gt;
起動すると，ubuntuの初回セットアップが始まるので適当に進める．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
さくっと動作できたので一旦VMシャットダウン．&lt;br /&gt;
&lt;br /&gt;
設定を変更&lt;br /&gt;
* システム&amp;gt;プロセッサ：2コア&lt;br /&gt;
* システム&amp;gt;マザーボード&amp;gt;メインメモリー：１GB&lt;br /&gt;
* ディスプレイ&amp;gt; スクリーン&amp;gt;ビデオメモリー:128MB&lt;br /&gt;
*&amp;nbsp;ディスプレイ&amp;gt; スクリーン&amp;gt;アクセラレーション:3Dアクセラレーションを有効化をON&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
再度起動して，（なにかエラーが出ましたが無視して），ウィンドウの「デバイス」メニューを開き、「Guest Additions のCDイメージを挿入」を選択 (&lt;b&gt;これは忘れがち&lt;/b&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
あとは，ubuntuのソフトウェアアップデートがあるはずなので，適宜適用する．&lt;br /&gt;
左のメニューの一番上から，updateと入力して，「ソフトウェアの更新」を実行．&lt;br /&gt;
終わるまで結構時間がかかるので，一服してから再開します．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. node.jsを起動する&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/7908165352763106262/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/12/virtualboxubuntunodejs.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/7908165352763106262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/7908165352763106262'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/12/virtualboxubuntunodejs.html' title='VirtualBoxにUbuntuをインストールしてnode.jsを立ち上げるまでのメモ'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-8954243522724132968</id><published>2015-09-30T19:35:00.000+09:00</published><updated>2015-09-30T19:35:06.417+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="unity"/><title type='text'>Unityでレイトレ</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
Unityをアセット管理として用いたレイトレプログラムを書いてみましょう．&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Unity5でレイトレーシング&lt;/h2&gt;
&lt;h3&gt;
はじめに&lt;/h3&gt;
&lt;h4&gt;
なぜUnityで行うか？&lt;/h4&gt;
&lt;div&gt;
先日から少しだけUnityを操作しているのですが，最近のゲームエンジンらしく物理ベースマテリアルに対応している上に，いろんなローダやアセットがたくさんあって，自分で書くよりこれでいいじゃん，と思ったところが始まりです．&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
ベタのレンダラを書いたことのある人はお分かりかと思いますが，最初に絵を出力するまでに，レンダリング以外の処理を書くのがすごく大変です．例えば，ファイルの読み込みや，画像として保存する，テクスチャに対応する，などなどです．ちょっとプレビューしたいと思ったり，それにGUIを付けたいと思っても，なんだかよくわからないことを，たくさんたくさん調べて書く必要があります．&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
そこで，&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
本論の目的は，初学者（私も含め）向けにレンダラの本質（と思われるところ）に焦点を&lt;/div&gt;
&lt;div&gt;
また，高速化や多くのテクニックの必要性を体験してもらうことです．&lt;/div&gt;
&lt;h4&gt;
&lt;div style=&quot;font-weight: normal;&quot;&gt;
なお他のアプローチとしては，任意のフレームをobj等に出力して，自作あるいは既存のレンダラでレンダリングする，という方法もあります．&lt;/div&gt;
&lt;div style=&quot;font-weight: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/h4&gt;
&lt;h4&gt;
開発環境&lt;/h4&gt;
&lt;div&gt;
os x 10.10&lt;/div&gt;
&lt;div&gt;
Unity 5.2.0f3&lt;/div&gt;
&lt;div&gt;
UnityScript (C#)&lt;/div&gt;
&lt;h4&gt;
開発指針&lt;/h4&gt;
&lt;div&gt;
レイキャスト，古典的レイトレ，パストレの流れを追う．&lt;/div&gt;
&lt;div&gt;
マテリアルはstandard shaderの設定を使う．&lt;/div&gt;
&lt;div&gt;
テクスチャ対応．&lt;/div&gt;
&lt;div&gt;
高速化手段はあまり考えない．&lt;/div&gt;
&lt;div&gt;
MMDモデルのレンダリングくらいまで．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
ここから&lt;/h3&gt;
&lt;h4&gt;
準備（適当に）&lt;/h4&gt;
&lt;div&gt;
新規プロジェクトを作成．&lt;/div&gt;
&lt;div&gt;
適当なオブジェクトの配置．&lt;/div&gt;
カメラの設定．&lt;br /&gt;
スクリプトを作成．&lt;br /&gt;
カメラに，作成したスクリプトをアタッチ．&lt;br /&gt;
&lt;br /&gt;
とりあえず，こんな感じにしてみました．&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc3HBQfM1S-c79iOTk5JXTn-bX-tSDh5u14XUt4iV8kMujX0ZsmMqBRxx-wQDnF5R19ICvM9SnviqlVobXF5_OqwePp-c95qmBX1gAiXClGIUD9sShD9XstraboKArVQPW-WnxcJwU9daz/s1600/UnityInitialScene.tiff&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Unity inital scene&quot; border=&quot;0&quot; height=&quot;244&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc3HBQfM1S-c79iOTk5JXTn-bX-tSDh5u14XUt4iV8kMujX0ZsmMqBRxx-wQDnF5R19ICvM9SnviqlVobXF5_OqwePp-c95qmBX1gAiXClGIUD9sShD9XstraboKArVQPW-WnxcJwU9daz/s320/UnityInitialScene.tiff&quot; title=&quot;Unity inital scene&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
絵を出す（モノクロから）&lt;/h3&gt;
&lt;div&gt;
レイトレーシングの基本的な考え方は，視点（カメラ）からたくさんの視線（レイ）を飛ばして，当たったオブジェクトの位置に基づいていろいろ計算して，色を決定します．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Unityでは便利なAPIがたくさん用意されているのでそれを使って，色の決定の部分を書いていく，という感じで進めます．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
レンダリング結果を保持するキャンバスを用意して画面に表示する&lt;/h4&gt;
&lt;div&gt;
レンダリング結果は，テクスチャに描画します．&lt;br /&gt;
&lt;br /&gt;
最初にテクスチャを用意します．今回は，スクリーンサイズと同じサイズのテクスチャをStart()で確保し，レンダリングのためのRendering()を呼びだします，&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
全画素について処理を行うため，横方向(width)と縦方向(height)の2重ループとなります．&lt;br /&gt;
レイトレースを行うには，各ピクセルにおいて，カメラから発するその画素位置を向いたレイを生成し，その結果に応じて色を計算します．&lt;br /&gt;
&lt;br /&gt;
この時点では，まず単純な背景色（黒）をテクスチャへ書き込み，そして画面への表示を行うだけの処理にします．&lt;br /&gt;
UnityのColorは不透明度を持っているので，黒の場合は (0.0f, 0.0f, 0.0f, 1.0f)とします．&lt;br /&gt;
また，数値で場合は必ずfloat精度として記述してください．うっかり new Color(0.0, 0.0, 0.0 1.0)のように記述すると，コンパイルに失敗してUnityがエラーとなってしまいます．&lt;/div&gt;
&lt;div&gt;
すべてのピクセルに色を設定したら，テクスチャのApply()で反映することを忘れないようにしてください．&lt;br /&gt;
描画した内容を画面に表示するために，OnGUI()コールバックを用意して，テクスチャを画面を覆うような領域に描画します．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script src=&quot;https://gist.github.com/cslroot/c66ebadf2ad3651bcab3.js&quot;&gt;&lt;/script&gt;

&lt;a href=&quot;https://gist.github.com/cslroot/c66ebadf2ad3651bcab3&quot;&gt;https://gist.github.com/cslroot/c66ebadf2ad3651bcab3&lt;/a&gt;&lt;br /&gt;
この状態で実行すると，真っ黒になると思います．&lt;br /&gt;
背景色として指定したbackgroundColorの値をいろいろ変えて，指定した色になることを確認してみましょう．&lt;br /&gt;
ここまでできれば，各ピクセルの色をどのように決定するか，という部分に集中して取り組むことができるでしょう．&lt;br /&gt;
&lt;h4&gt;
レイを飛ばして，当たったところを表示する&lt;/h4&gt;
Unityでは，Physics.Raycast()という大変便利な関数が用意されています．このAPIは，任意の位置（座標）と指定の方向（ベクトル）を指定することで，その半直線の交差情報を取得することができます．&lt;br /&gt;
交差情報は，単純に当たった/当たっていないだけではなく，どの物体（シーン内のGameObject）にあたったか，その位置，法線，uv座標なども取得することが可能です．&lt;br /&gt;
&lt;br /&gt;
注意：当たったかどうか，はCollider（コライダ）と呼ばれるコンポーネントで判定されます．Colliderがアタッチされていない要素には当たり判定がないため，Raycast()では無視されてしまいます．&lt;br /&gt;
&lt;br /&gt;
これを使うには，各ピクセルに対しするレイの位置と方向を算出する必要がありますが，Unityにはその計算を自動的に行なってくれるAPIが用意されています：&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;mainCamera.ScreenPointToRay(Vector3(w, h, 0));&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
それではまず，当たった場合に白，当たらない場合に黒で表示するように改造してみます．&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/cslroot/4eb475710a11f87f174e.js&quot;&gt;&lt;/script&gt;&lt;a href=&quot;https://gist.github.com/cslroot/4eb475710a11f87f174e&quot;&gt;https://gist.github.com/cslroot/4eb475710a11f87f174e&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxoKIrjYjndtRby6ibbXrvyW64ozVbUaWMaoaQpVu_D20xT8hLtvxcuAs2vXXaJoqxY2X1osO1uhbFT9GXAzKbyCV7UZbIoKrpvlw9wygq0IDfYl_qlBOTvoUDdtoEQx6gsQXGYR0o2o6-/s1600/MainScene_unity_-_UnityRayTrace_-_PC__Mac___Linux_Standalone__Personal_.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;213&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxoKIrjYjndtRby6ibbXrvyW64ozVbUaWMaoaQpVu_D20xT8hLtvxcuAs2vXXaJoqxY2X1osO1uhbFT9GXAzKbyCV7UZbIoKrpvlw9wygq0IDfYl_qlBOTvoUDdtoEQx6gsQXGYR0o2o6-/s320/MainScene_unity_-_UnityRayTrace_-_PC__Mac___Linux_Standalone__Personal_.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
オブジェクトの色を表示する&lt;/h4&gt;
&lt;div&gt;
物体が表示されましたが，陰影もなく色もない状態です．&lt;/div&gt;
&lt;div&gt;
そこで，当たった点の情報を利用して物体色を反映させたいと思います，&lt;/div&gt;
&lt;div&gt;
現時点では2つの物体（CubeとSphere）に材質情報がありませんので，まずはマテリアルを用意します．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Unity上の操作&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
プロジェクトビューから，新規のマテリアルを作成します(Create &amp;gt; Material)．&lt;/div&gt;
&lt;div&gt;
それぞれの物体に別々のマテリアルを持たせるので2つ作成しておきましょう(MatCube, MatSphere)．&lt;/div&gt;
&lt;div&gt;
それらのマテリアルを選択して，Albedoの色を指定します．とりあえず赤と青にしておきます．&lt;/div&gt;
&lt;div&gt;
マテリアルを，Hierarchy内のCubeとSphereにそれぞれドラッグ＆ドロップしてアタッチします．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ここまでの操作で，Unity上の物体に色が反映されたと思います．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQkat8lMyVbdJYU31bQmfVDI_q3cZ_CcuXsKvtpnUOpFkI50BNBMa1ymbfPhHCWNJr5rxcoJIl-xyPrTUwB3Q3gLfNulcikRC2RRR6YoXnNjeNGPQiyEV5mW53qpFFeVNLvS4venIcbuFP/s1600/MainScene_unity_-_UnityRayTrace_-_PC__Mac___Linux_Standalone__Personal_+2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;110&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQkat8lMyVbdJYU31bQmfVDI_q3cZ_CcuXsKvtpnUOpFkI50BNBMa1ymbfPhHCWNJr5rxcoJIl-xyPrTUwB3Q3gLfNulcikRC2RRR6YoXnNjeNGPQiyEV5mW53qpFFeVNLvS4venIcbuFP/s320/MainScene_unity_-_UnityRayTrace_-_PC__Mac___Linux_Standalone__Personal_+2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;ScriptからAlbedoカラーの取得&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
色を取得するには，レイと交差した物体のマテリアルを参照する必要があります．&lt;/div&gt;
&lt;div&gt;
これは，Raycast()のout引数であるRaycastHit構造体から，collider経由で取得します．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;script src=&quot;https://gist.github.com/cslroot/ce44b752bedce904c6ac.js&quot;&gt;&lt;/script&gt;
https://gist.github.com/cslroot/ce44b752bedce904c6ac
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj76sGRXCIgurrpq3EsCHMYtNyJgTGCz79iBhbHzuf3gaFOeTRWVH945G5oh4jkPjOERFX5n6c9Rd_e_cpjl-XfYL7uugbWWCacEyNEfjxO9IWzONUFeMVJcj-xyLG2zdt19B_ng1qTEWDh/s1600/MainScene_unity_-_UnityRayTrace_-_PC__Mac___Linux_Standalone__Personal_+3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj76sGRXCIgurrpq3EsCHMYtNyJgTGCz79iBhbHzuf3gaFOeTRWVH945G5oh4jkPjOERFX5n6c9Rd_e_cpjl-XfYL7uugbWWCacEyNEfjxO9IWzONUFeMVJcj-xyLG2zdt19B_ng1qTEWDh/s320/MainScene_unity_-_UnityRayTrace_-_PC__Mac___Linux_Standalone__Personal_+3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
テクスチャマッピングを有効にする&lt;/h4&gt;
マテリアルが取得できればテクスチャも簡単に習得できます．&lt;br /&gt;
テクスチャが設定されている場合は，Material.mainTextureプロパティでアクセスできます．&lt;br /&gt;
また，レイと交差した箇所のテクスチャ座標は，RaycastHit.textureCoordに格納されています．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/cslroot/ddcff7c39476e19da582.js&quot;&gt;&lt;/script&gt;

https://gist.github.com/cslroot/ddcff7c39476e19da582&lt;br /&gt;
&lt;br /&gt;
テクスチャを使うときに重要な点が1つあります．&lt;br /&gt;
スクリプトからテクスチャの値を取得する場合は，テクスチャの設定で「Read/Write Enble」を変更しなければなりません．これをしない場合，実行時にエラーが発生します．&lt;br /&gt;
テクスチャを選択「Texture Type &amp;gt; Advanced」にして「Read/Write Enable」をONにしてください．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
今回はこのへんでー．&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
参考文献&lt;/h3&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/BenjaminSchaaf/Unity-Raytracer&quot;&gt;https://github.com/BenjaminSchaaf/Unity-Raytracer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;でわでわ．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/8954243522724132968/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/09/unity_30.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/8954243522724132968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/8954243522724132968'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/09/unity_30.html' title='Unityでレイトレ'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc3HBQfM1S-c79iOTk5JXTn-bX-tSDh5u14XUt4iV8kMujX0ZsmMqBRxx-wQDnF5R19ICvM9SnviqlVobXF5_OqwePp-c95qmBX1gAiXClGIUD9sShD9XstraboKArVQPW-WnxcJwU9daz/s72-c/UnityInitialScene.tiff" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-2651806414151386526</id><published>2015-09-13T11:37:00.002+09:00</published><updated>2015-09-30T19:35:32.799+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MMD"/><category scheme="http://www.blogger.com/atom/ns#" term="unity"/><title type='text'>Unityの画面を動画にする</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
前回の続きで，Unityで遊んでいます．&lt;br /&gt;
今回は，Unity画面を連番キャプチャして&lt;br /&gt;
&lt;br /&gt;
きっと他の開発者の方が作られていると思いますが，Unityスクリプトの勉強として作成しています．&lt;br /&gt;
&lt;br /&gt;
まずは連番出力&lt;br /&gt;
かるく調べた感じですと，3つの方法がありそうです：&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;「Application.CaptureScreenShot」というそのまんまなAPIを使う方法&lt;/li&gt;
&lt;li&gt;RenderTextureを使う方法&lt;/li&gt;
&lt;li&gt;Texture2DのReadPixelsを使う方法&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
今回は任意のサイズで保存したかったので，3番目の方法を採用します．&lt;br /&gt;
ちなみに，1番目の方法は遅い，とのこと．&lt;br /&gt;
&lt;br /&gt;
とりあえずザクッと書いてみました．&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/cslroot/4d538873d5ed8c4580da.js&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;
連番画像を動画にする&lt;/h3&gt;
ffmpegで簡単に作成できます．&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/cslroot/115a69b38cafb60c68b2.js&quot;&gt;&lt;/script&gt;

30と書いた箇所は，指定したFrameRate（出力時のフレームレート）と同じにしてください．&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&quot;&quot; class=&quot;YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/a29z7VqxB9s/0.jpg&quot; frameborder=&quot;0&quot; height=&quot;266&quot; src=&quot;https://www.youtube.com/embed/a29z7VqxB9s?feature=player_embedded&quot; width=&quot;320&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
参考文献&lt;/h3&gt;
http://blog.almostlogical.com/2009/12/11/render-to-texture-unity3d/&lt;br /&gt;
http://answers.unity3d.com/questions/22954/how-to-save-a-picture-take-screenshot-from-a-camer.html&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/2651806414151386526/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/09/unity.html#comment-form' title='1 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2651806414151386526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2651806414151386526'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/09/unity.html' title='Unityの画面を動画にする'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/a29z7VqxB9s/default.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-871064663361069275</id><published>2015-09-12T10:35:00.000+09:00</published><updated>2015-09-12T10:35:09.329+09:00</updated><title type='text'>はじめてのUnityプロジェクト：MMDを動かす</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
はじめに&lt;/h3&gt;
とあるところで「主婦ゆに」（サイン入り）を手に入れました！&lt;br /&gt;
Unityにはあまり興味がなかったのですが，せっかくなので触ってみようと思います．&lt;br /&gt;
&lt;br /&gt;
とりあえずはお手本通りに，MMDモデル(PMD, VMD)を読み込み，踊ってもらおうと思います．&lt;br /&gt;
&lt;br /&gt;
なお，Unity5のインストール，アカウント作成を完了したところからスタートとします．&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
環境&lt;/h4&gt;
MacBook (Retina, 12-inch, Early 2015)&lt;br /&gt;
OS X 10.10 &amp;nbsp;Yosemite&lt;br /&gt;
Unity 5.2.0f3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.co.jp/gp/product/4798042765/ref=as_li_ss_il?ie=UTF8&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=4798042765&amp;amp;linkCode=as2&amp;amp;tag=closed-22&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://ws-fe.amazon-adsystem.com/widgets/q?_encoding=UTF8&amp;amp;ASIN=4798042765&amp;amp;Format=_SL110_&amp;amp;ID=AsinImage&amp;amp;MarketPlace=JP&amp;amp;ServiceVersion=20070822&amp;amp;WS=1&amp;amp;tag=closed-22&quot; /&gt;&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-jp.amazon-adsystem.com/e/ir?t=closed-22&amp;amp;l=as2&amp;amp;o=9&amp;amp;a=4798042765&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
プロジェクトの作成&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Newで新規プロジェクトを作成&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
3Dを選択&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
アセットはあとから追加できるので，Asset Packagesは特に変更なし&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Create Project&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
とりあえずシーンを保存する&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
シーンは，ゲーム開発でいう&quot;レベル&quot;に相当．&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Save Scene&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Asset直下はいろいろなアセットが増えていくのでScenesフォルダを作ってそこに保存．&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;clear: both; text-align: left;&quot;&gt;
MMDファイルの読込み&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
MMD4Mecanim.unitypackageをダブルクリックしてインポート．&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
各種MMDファイル(pmd, vmd)をアセットに追加（Projectタブにドラッグ＆ドロップ）&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
〜〜.pmdファイルの対応する箇所に，〜〜.MMD4Mecanimが生成されているので選択&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Inspectorウィンドウに利用条件が出てくるので確認し，チェックONで右下の「同意する」を押す&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Inspectorをロックしておく&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
モーション(*.vmdファイル)をVMD欄にドラッグ&amp;amp;ドロップする．&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Processボタンを押す&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
#変換処理が完了するまで暫く待つ．&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
pmdと同フォルダにfbxファイルができているので，それをHierarchy（またはScene）にドラッグ＆ドロップ．&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;clear: both; text-align: left;&quot;&gt;
動かす&lt;/h4&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
空のAnimator Controllerを追加（Create &amp;gt; Animator Controller）&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
作成したAnimator Controllerをシーンに配置したMMDモデルのinspectorのAnimator &amp;gt; Controllerにドラッグ＆ドロップで設定&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
作成したAnimator ControllerをダブルクリックしてAnimatorウィンドウを開く&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
プロジェクト内のモデルデータを（三角形を押して）展開し，読込み時に指定した*.vmdファイルをAnimatorウィンドウにドラッグ＆ドロップする&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
ここまでで，再生を押すと踊るよ．&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
でも残念な感じのカメラなので調整しましょう．&lt;/div&gt;
&lt;h4 style=&quot;clear: both; text-align: left;&quot;&gt;
カメラを自動追従に変更する&lt;/h4&gt;
&lt;div&gt;
既存のMainCameraは削除．&lt;/div&gt;
&lt;div&gt;
メニューの Assets &amp;gt; Import Package &amp;gt; Cameras をインポート&lt;/div&gt;
&lt;div&gt;
ProjectウィンドウのAssetからHandheldCamera(Standard Assets &amp;gt; Cameras &amp;gt; Prefab)をシーンに追加&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
カメラの向きがいまいちなので，適当に位置合わせ&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; Position &amp;gt; X: 0 / Y: 0.5 / Z: 2.0&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; Rotation &amp;gt; X: -10 / Y: 180 / Z: 0&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
デフォルトのクリッピングを 変更 Clipping Planes &amp;gt; Near: 0.1 / Far: 100&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
FOVも気に入らないので変更 Field of view: 50&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
追従するように設定 Hand Held Cam (Script) &amp;gt; Target: 適当なジョイント（67.joint_Neck）&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
再生して確認&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
→ あまりにも激しく動いて良いそうなので，カメラの追従速度を調整する&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; Following Speed: 0.5&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; FOV: 35&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; Position: Y: 1&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp; Rotation: 355&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXdu0srcJtuU9kPadBSvVxbAWu2qDuD5k_VmZUoV-bIqX6xqrHpGei8RJ3H5Z58lj1l0OBKc-ibRxm1H9KrZTLVmDlU6j_3AP8voKiNf2vuvZ6sTZK0JAN2jnTIhyBjW70wp0kKF_M_F66/s1600/MyFirstUnityProject_unity_-_MyFirstUnityProject_-_PC__Mac___Linux_Standalone__Personal_+2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;229&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXdu0srcJtuU9kPadBSvVxbAWu2qDuD5k_VmZUoV-bIqX6xqrHpGei8RJ3H5Z58lj1l0OBKc-ibRxm1H9KrZTLVmDlU6j_3AP8voKiNf2vuvZ6sTZK0JAN2jnTIhyBjW70wp0kKF_M_F66/s320/MyFirstUnityProject_unity_-_MyFirstUnityProject_-_PC__Mac___Linux_Standalone__Personal_+2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/871064663361069275/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/09/unitymmd.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/871064663361069275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/871064663361069275'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/09/unitymmd.html' title='はじめてのUnityプロジェクト：MMDを動かす'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXdu0srcJtuU9kPadBSvVxbAWu2qDuD5k_VmZUoV-bIqX6xqrHpGei8RJ3H5Z58lj1l0OBKc-ibRxm1H9KrZTLVmDlU6j_3AP8voKiNf2vuvZ6sTZK0JAN2jnTIhyBjW70wp0kKF_M_F66/s72-c/MyFirstUnityProject_unity_-_MyFirstUnityProject_-_PC__Mac___Linux_Standalone__Personal_+2.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-5040766548381861265</id><published>2015-08-10T15:58:00.001+09:00</published><updated>2015-08-10T15:58:40.997+09:00</updated><title type='text'>Xcodeでも「上の行に改行」したい！</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
普段はWindowsのVisual Studioを使っていたりいなかったりするのだけれど，&lt;br /&gt;
VSでよく使うショートカットの1つに「CTRL&amp;nbsp;+ ENTER」があります．&lt;br /&gt;
&lt;br /&gt;
これはエディタ上で，「1つ上の行に改行を入れる」という操作を&lt;br /&gt;
&lt;br /&gt;
例えば，コード補完等によって，次のような状態担っているとします（★印がカーソル位置）．&lt;br /&gt;
-------------&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if (false) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}★&lt;/span&gt;&lt;br /&gt;
-------------&lt;br /&gt;
ここでおもむろに「CTRL+ENTER」を押下すると，&lt;br /&gt;
-------------&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if (false) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;★&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
-------------&lt;br /&gt;
&lt;div&gt;
こんなふうになります．&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
先にフローの構造を作ってから編集する，という思考ルーチンなのでこの手順が極めて大切なのです．&lt;br /&gt;
&lt;br /&gt;
xcodeにもそれっぽいのがあるはず！と思っていましたが，&lt;br /&gt;
どうやらなさそうなので，Karabinar（旧 KeyRemap4MacBook）で独自ショートカットを定義しました．&lt;br /&gt;
gistに置いときます．&lt;br /&gt;
https://gist.github.com/cslroot/376f6ac7724e9f1ff705&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/cslroot/376f6ac7724e9f1ff705.js&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
これで開発効率が5%くらいアップしたはず！
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/5040766548381861265/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/08/xcode.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/5040766548381861265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/5040766548381861265'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/08/xcode.html' title='Xcodeでも「上の行に改行」したい！'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-6782233665369897656</id><published>2015-08-10T02:21:00.001+09:00</published><updated>2015-08-10T02:21:10.644+09:00</updated><title type='text'>GUI付きのビューアをつくりたいのでocornut/imguiを使ってみた</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
レイトレした結果をどう確認していますか？&lt;br /&gt;
&lt;br /&gt;
PNGファイル出力をしていますが，毎回開くのも嫌だし，&lt;br /&gt;
入力ファイル指定や途中経過などなどをGUIから行いたいです．&lt;br /&gt;
&lt;br /&gt;
でサクッとビューアをつくろうと思って，&lt;br /&gt;
過去に使ったことのあるGLUIを使おうと思いましたが，今回はGLFWを使ってウィンドウ表示するため使えません．&lt;br /&gt;
&lt;br /&gt;
そこで最近のGUIライブラリを調べつつ，ImGuiというライブラリを使うことにしました．&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
試したGUI&lt;/h3&gt;
&lt;div&gt;
（参考：&amp;nbsp;&lt;a href=&quot;http://qiita.com/shimacpyon/items/e5d2a4e2019273345c37&quot;&gt;OpenGL な UI を作るライブラリ一覧&lt;/a&gt;）&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;h4&gt;
&lt;a href=&quot;http://anttweakbar.sourceforge.net/doc/&quot;&gt;AntTweakBar (http://anttweakbar.sourceforge.net/doc/)&lt;/a&gt;&lt;/h4&gt;
&lt;/div&gt;
見た目も良さげでhomebrewでインストールできたので試してみましたが，&lt;br /&gt;
osxのretinaディスプレイに対応しておらず，描画は可能なもののマウス位置と整合性がとれておらず使用を断念しました．&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
GWEN(&lt;a href=&quot;https://github.com/garrynewman/GWEN&quot;&gt;https://github.com/garrynewman/GWEN&lt;/a&gt;)&lt;/h4&gt;
&lt;div&gt;
1年くらい更新されていないのと，osx対応されていなさそうなのでやめ．&lt;/div&gt;
&lt;div&gt;
見た目は一番好みだったのだけれど．&lt;/div&gt;
&lt;br /&gt;
&lt;h4&gt;
CEGUI&lt;/h4&gt;
ヘビィそうなのでやめとく．&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
AdrienHerubel/imgui (&lt;a href=&quot;https://github.com/AdrienHerubel/imgui&quot;&gt;https://github.com/AdrienHerubel/imgui&lt;/a&gt;)&lt;/h4&gt;
かなり良さそうだったけれど，あまりにもコミットが少なくメンテされてなさそうなのでNG．&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
blendish&lt;/h4&gt;
&lt;div&gt;
blender-likeすぎて辛い．あと依存関係がヘビィ．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;ocornut/imgui&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;
ハマりポイント&lt;/h3&gt;
&lt;h4&gt;
1. 文字がちっちゃい＝全体が小さい&lt;/h4&gt;
&lt;div&gt;
retinaに完全対応していないのか，文字が極めて小さく表示されてしまいました．&lt;/div&gt;
&lt;div&gt;
ボタン等はちゃんとマウス位置に反応しているので，次の2通りの方法のどちらかで，暫定的に回避できました．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;フォント読み込み時に，フォントサイズを大きくする．&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&amp;nbsp; io.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Fonts&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;AddFontFromFileTTF&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;&quot;resource/uzura.ttf&quot;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;s4&quot;&gt;16.0f&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;s5&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, io.&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Fonts&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;GetGlyphRangesJapanese&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;());&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
→ &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;16.0f&lt;/span&gt;&quot;&lt;span style=&quot;font-family: inherit;&quot;&gt;を&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&quot;32.0f&quot;&lt;/span&gt;&amp;nbsp;にするとか．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
※ README.mdの文字列サンプルは間違ってるので注意．第3引数にNULLを指定する必要があります．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;グローバルスケールなるパラメータを2倍にする&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;







&lt;div class=&quot;p1&quot;&gt;
次のようにウィンドウサイズとフレームバッファサイズを比べて掛けとく．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span class=&quot;s2&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p3&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;// osx retina 2x&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s5&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; w, h;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s6&quot;&gt;glfwGetWindowSize&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(window, &amp;amp;w, &amp;amp;h);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s5&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; ww, hh;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s6&quot;&gt;glfwGetFramebufferSize&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(window, &amp;amp;ww, &amp;amp;hh);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; io.&lt;/span&gt;&lt;span class=&quot;s7&quot;&gt;FontGlobalScale&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; = ww / w;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s6&quot;&gt;fprintf&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s8&quot;&gt;stderr&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;window(%d, %d) : frameBuffer(%d, %d)\n&quot;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;, w, h, ww, hh);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p5&quot;&gt;
&lt;span class=&quot;s2&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; io.&lt;/span&gt;&lt;span class=&quot;s7&quot;&gt;UserData&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; = &amp;amp;input;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span class=&quot;s2&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4&gt;
2. &amp;nbsp;2フレーム目から描画されない；&lt;/h4&gt;
描画は次のような感じで行けますが，適当に拾ってきたModernなOpenGLサンプルでテクスチャ付き四角形を描画していたら，2フレーム目から描画されませんでした．&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt; (!&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;glfwWindowShouldClose&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;(window))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span class=&quot;s3&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p3&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;//----- ImGui のセットアップ ----&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s3&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s4&quot;&gt;ImGuiIO&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;&amp;amp; io = &lt;/span&gt;&lt;span class=&quot;s4&quot;&gt;ImGui&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;s4&quot;&gt;GetIO&lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;ImGui_ImplGlfwGL3_NewFrame&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p5&quot;&gt;
&lt;span class=&quot;s3&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; { // 〜〜 ImGuiのメニューなど&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p5&quot;&gt;
&lt;span class=&quot;s3&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // ここら辺に自分の描画したいコードを書く&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span class=&quot;s2&quot;&gt;ImGui&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Render&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s3&quot;&gt;glfwSwapBuffers&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;(window);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p3&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;s4&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;glfwPollEvents&lt;/span&gt;&lt;span class=&quot;s4&quot;&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;span class=&quot;s1&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
かなり悩ましい問題でしたが，GUIコントロールのレンダリング時に glEnable(GL_BLEND)されているためでした．&lt;br /&gt;
まあそういうこともあるよね．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
あまり使用実績がないので，ググってもあまり情報が出てこないのが辛いかな．&lt;br /&gt;
コンパクトにいろんな機能が用意されていることと，活発に更新されていることが優位な点なので，今後もウォッチしていきます．&lt;br /&gt;
&lt;br /&gt;
でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/6782233665369897656/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/08/guiocornutimgui.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/6782233665369897656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/6782233665369897656'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/08/guiocornutimgui.html' title='GUI付きのビューアをつくりたいのでocornut/imguiを使ってみた'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-3314670529180556898</id><published>2015-08-02T13:47:00.004+09:00</published><updated>2015-08-02T13:51:28.679+09:00</updated><title type='text'>買った本</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://rcm-fe.amazon-adsystem.com/e/cm?lt1=_blank&amp;amp;bc1=000000&amp;amp;IS2=1&amp;amp;nou=1&amp;amp;bg1=FFFFFF&amp;amp;fc1=000000&amp;amp;lc1=0000FF&amp;amp;t=closed-22&amp;amp;o=9&amp;amp;p=8&amp;amp;l=as4&amp;amp;m=amazon&amp;amp;f=ifr&amp;amp;ref=ss_til&amp;amp;asins=4274066924&quot; style=&quot;height: 240px; width: 120px;&quot;&gt;&lt;/iframe&gt;

&lt;br /&gt;
&lt;iframe frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://rcm-fe.amazon-adsystem.com/e/cm?lt1=_blank&amp;amp;bc1=000000&amp;amp;IS2=1&amp;amp;nou=1&amp;amp;bg1=FFFFFF&amp;amp;fc1=000000&amp;amp;lc1=0000FF&amp;amp;t=closed-22&amp;amp;o=9&amp;amp;p=8&amp;amp;l=as4&amp;amp;m=amazon&amp;amp;f=ifr&amp;amp;ref=ss_til&amp;amp;asins=4621073486&quot; style=&quot;height: 240px; width: 120px;&quot;&gt;&lt;/iframe&gt;

&lt;br /&gt;
昨日のお昼くらいにポチったのですが，約8時間で受け取れました．&lt;br /&gt;
お急ぎ便は早いな！&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/3314670529180556898/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/08/blog-post_2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/3314670529180556898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/3314670529180556898'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/08/blog-post_2.html' title='買った本'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-1736795000499441695</id><published>2015-08-01T09:00:00.007+09:00</published><updated>2015-08-01T09:00:39.714+09:00</updated><title type='text'>読んだ</title><content type='html'>&lt;div&gt;
最近読んだもの。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0); text-align: center;&quot;&gt;The comprehensive PBR guide&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://www.allegorithmic.com/pbr-guide&quot;&gt;https://www.allegorithmic.com/pbr-guide&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
基礎基礎の確認に丁度いいです。&lt;/div&gt;
&lt;div&gt;
ただし、エンジニアというよりモデラーとかそっちの人向けかな。&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; font-family: &#39;Helvetica Neue Light&#39;, HelveticaNeue-Light, helvetica, arial, sans-serif; text-align: center;&quot;&gt;Substanceを開発してる企業。&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; font-family: &#39;Helvetica Neue Light&#39;, HelveticaNeue-Light, helvetica, arial, sans-serif; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; font-family: &#39;Helvetica Neue Light&#39;, HelveticaNeue-Light, helvetica, arial, sans-serif; text-align: center;&quot;&gt;日本語版も公開されている方がいます．&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; font-family: &#39;Helvetica Neue Light&#39;, HelveticaNeue-Light, helvetica, arial, sans-serif; text-align: center;&quot;&gt;http://www.slideshare.net/nyaakobayashi/pbr-guide-vol1jp&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; font-family: &#39;Helvetica Neue Light&#39;, HelveticaNeue-Light, helvetica, arial, sans-serif; text-align: center;&quot;&gt;http://www.slideshare.net/nyaakobayashi/70100srgb180255&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
（ボーンデジタルでも配布していたけれど，認証が必要でしたので未確認）&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/1736795000499441695/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/08/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1736795000499441695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1736795000499441695'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/08/blog-post.html' title='読んだ'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-2652128369236384327</id><published>2015-07-25T11:39:00.001+09:00</published><updated>2015-07-25T11:39:57.643+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="renderer"/><title type='text'>とりま</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-JjUIXnoEvaKH-wTsUN8DAER9HZ07V6w-WxO9qM-j-fe9zYtcpeWECtlX4V0iP5diW507XOe1XfoQv-kO2BG2Jnz9suwD709DdxacvZB7pU2lWGKfy7o0qZXcNu3gW_GLGA2zS61lsywM/s1600/test.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-JjUIXnoEvaKH-wTsUN8DAER9HZ07V6w-WxO9qM-j-fe9zYtcpeWECtlX4V0iP5diW507XOe1XfoQv-kO2BG2Jnz9suwD709DdxacvZB7pU2lWGKfy7o0qZXcNu3gW_GLGA2zS61lsywM/s320/test.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8mpr-GO8dfbCozwLGWXQxD_ZKDjgC4DS0am_BZA9gQlHSwU5Wli92s8lBgXurcj_Qp5de0c_sE0YXZKzgFssN63tRINtYI_XFI01Jh7fHLuImY0ZO_hSCZjif7fpTvfFVhUCxE1i77eZD/s1600/test+copy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8mpr-GO8dfbCozwLGWXQxD_ZKDjgC4DS0am_BZA9gQlHSwU5Wli92s8lBgXurcj_Qp5de0c_sE0YXZKzgFssN63tRINtYI_XFI01Jh7fHLuImY0ZO_hSCZjif7fpTvfFVhUCxE1i77eZD/s320/test+copy.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;








&lt;br /&gt;
&lt;div class=&quot;p1&quot;&gt;
&amp;gt; RenderTime: 28171.4&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
いけてなさすぎる．&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&amp;nbsp;でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/2652128369236384327/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post_13.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2652128369236384327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2652128369236384327'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post_13.html' title='とりま'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-JjUIXnoEvaKH-wTsUN8DAER9HZ07V6w-WxO9qM-j-fe9zYtcpeWECtlX4V0iP5diW507XOe1XfoQv-kO2BG2Jnz9suwD709DdxacvZB7pU2lWGKfy7o0qZXcNu3gW_GLGA2zS61lsywM/s72-c/test.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-808874673588092328</id><published>2015-07-25T11:24:00.003+09:00</published><updated>2015-07-25T11:24:32.056+09:00</updated><title type='text'>メモ</title><content type='html'>レイトレ系の話は，別のblogに書いてたのだけれど，&lt;br /&gt;
bloggerがエラーを出して死んでしまったのでこちらに移植しました．&lt;br /&gt;
&lt;br /&gt;
何が行けなかったんだろう…．&lt;br /&gt;
独自ドメインで動かそうとしたからかなあ．&lt;br /&gt;
でも設定自体は済んでて，ちゃんと独自ドメインでアクセスできるようになってたのに．&lt;br /&gt;
&lt;br /&gt;
ううん．&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/808874673588092328/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post_6.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/808874673588092328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/808874673588092328'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post_6.html' title='メモ'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-6557215977327455225</id><published>2015-07-25T10:53:00.002+09:00</published><updated>2015-07-25T12:41:24.523+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="renderer"/><category scheme="http://www.blogger.com/atom/ns#" term="xcode"/><title type='text'>XCodeのLLVM(clang)でOpenMPを使おう(解決)</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
高速化って大切ですよね．&lt;br /&gt;
結果が出るまで待てない，AWSに余計なお金を払いたくない，などなど，進化した計算機といえどもCPU資源を使いきって高速に処理する需要はなくなることはありません．&lt;br /&gt;
&lt;br /&gt;
CPU自体の進化も，クロックの高速化競争の集結を迎え，シングルスレッド性能は頭打ちになってきています．&lt;br /&gt;
この背景には，半導体プロセス微細化によるリーク電流や，数GHzを超えると電子の移動速度も際どくなる等が要因として挙げられていたと記憶しています．&lt;br /&gt;
＃ 消費電力あたりの性能，という指標は個人的には好きではありません…．&lt;br /&gt;
&lt;br /&gt;
そのため，現在のCPUではマルチコア，ハイパースレッド等の技術によって，処理を複数同時に実行できることでCPU全体としての性能向上を維持しています．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
プログラミング技術においてもその方向に進んでいて，いかに並列処理をするか，というのが現代的なプログラムの重要なポイントの1つとなっています．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
様々な並列処理手法がありますが，C++で開発する際に，お手軽に並列化する方法の1つにOpenMPというライブラリがあります．&lt;br /&gt;
このOpenMPは，名前がちょっとOpenGLに似ていますが全然関係なくて，並列処理を簡易的に実装する&lt;br /&gt;
&lt;br /&gt;
しかも最近のVisual Studio(VS2010以降？)では標準的に使えるようになっていて，&lt;br /&gt;
プロジェクト設定をちょいちょいと変えてあげるだけで有効になる，とってもとっても便利なライブラリで，特にレイトレのような並列化の容易なアプリケーションでは，たった1行追加するだけでバリバリ並列化できちゃう夢のような仕組みです．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
しかし残念なことに，OSX上のXCodeで開発している場合は，VSほど簡単に有効にすることはできないようです．これはXcodeの標準コンパイラがLLVM clang3.5であり(MacOS 10.9.5 Xcode6.2時点)，ちゃんと対応されていないバージョンのためです．&lt;br /&gt;
そのうち標準対応されるのではないか，と想像していますが，現時点では望めません．&lt;br /&gt;
&lt;br /&gt;
# 10.10の環境は未調査．今のところ，あのフォルダアイコンのださいOSをメイン環境として使う気がないため．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ということで，自前でスレッド処理するが，gccに切り替えて使うべきか，いっそのことWindowで開発するか，といった悩ましい問題が目の前に立ちはだかっているのです．&lt;br /&gt;
&lt;br /&gt;
いろいろ探していましたが，OpenMPを有効化したclang-ompが配布されていたので導入す&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
ここから本題です．&lt;/h4&gt;
&lt;br /&gt;
&lt;h2&gt;
Xcodeで clang-omp の使い方&lt;/h2&gt;
&lt;div&gt;
&lt;a href=&quot;https://clang-omp.github.io/&quot;&gt;https://clang-omp.github.io/&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;homebrew でclang-ompをインストール:&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;brew install clang-omp&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Xcodeプロジェクトを作成&lt;/li&gt;
&lt;li&gt;ビルドセッティング(Build Setting)で：&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;新しいユーザ定義設定 CC を次の値で作成：&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/usr/local/bin/clang-omp&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;-fopenmp&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;を&lt;i&gt;Other C Flags&lt;/i&gt;に追加&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/usr/local/include&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;を&lt;i&gt;Header Search Paths&lt;/i&gt;に追加&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Enable Modules (C and Objective-C)&lt;/i&gt;を&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;No&lt;/span&gt;にセット&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;ビルドフェーズ(Build Phases)で：&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/usr/local/lib/libiopm5.dylib&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;を&lt;i&gt;Link Binary With Librarian&lt;/i&gt;に追加&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;（＊）&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/usr/local/bin&lt;/span&gt;にhomebrewでインストールされた&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;clang-omp++&lt;/span&gt;というエイリアスがあるので，&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;clang++-omp&lt;/span&gt;に名前を変更&lt;/li&gt;
&lt;ol&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
これで完了．あとは&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#include &amp;lt;libiomp/omp.h&amp;gt;&lt;/span&gt;して，&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#pragma omp&lt;/span&gt;〜〜を使うだけ？．&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;
注意&lt;/h4&gt;
なぜかビルドできませんでしたが，上記手順の5を追加することで上手く動くようになりました．&lt;br /&gt;
どうやらXcodeは，C++のコンパイル時にCCに定義されたものを自動的に置換しているようです．その際に，末尾に++を追加するのではなく，clangをclang++に置換するようです．（途中のバージョンで仕様が変わったのかな…）&lt;br /&gt;
&lt;br /&gt;
ということで，暫定的な対策ですが，clang-omp++の名前をclang++-ompにすることで，上手くそれを使ってくれるようにできました．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h4&gt;
補足&lt;/h4&gt;
&lt;div&gt;
glmがコンパイラを認識できずに次のエラーを出しましたので対応しました．&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;/usr/local/include/glm/detail/setup.hpp:287:2: error: &quot;GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message.&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#error &quot;GLM_COMPILER undefined, your compiler may not be supported by GLM. Add #define GLM_COMPILER 0 to ignore this message.&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;^&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;1 error generated.&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Command /usr/local/bin/clang-omp failed with exit code 1&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
TODO&lt;/h3&gt;
&lt;div&gt;
後日，効果を検証します．&lt;/div&gt;
なんかビルド時のエラーの出かたが変化した気がする…&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
でわでわ．&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/6557215977327455225/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/xcodellvmclangopenmp.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/6557215977327455225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/6557215977327455225'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/xcodellvmclangopenmp.html' title='XCodeのLLVM(clang)でOpenMPを使おう(解決)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-1906604186211560916</id><published>2015-07-25T10:51:00.002+09:00</published><updated>2015-07-25T10:54:28.868+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="renderer"/><title type='text'>1024 x 768 with 20 path /subpx and  2x2 subpixel</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe58uwHmoQjzkkbxx6K0cxIJASyMtp7R4z2ln6t2Qc7BBxDVfOUgLSabUZd5onblheQ14j8LQJvjMAhgD_1m0EGLT7tsaCxNH-EPgEvYQWZxv0_ymvYm-wpb3NaHgNraWRjYJm2u3xK6s/s1600/test.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe58uwHmoQjzkkbxx6K0cxIJASyMtp7R4z2ln6t2Qc7BBxDVfOUgLSabUZd5onblheQ14j8LQJvjMAhgD_1m0EGLT7tsaCxNH-EPgEvYQWZxv0_ymvYm-wpb3NaHgNraWRjYJm2u3xK6s/s320/test.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
うーん遅い．&lt;br /&gt;
&lt;br /&gt;
でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/1906604186211560916/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/1024-x-768-with-20-path-subpx-and-2x2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1906604186211560916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1906604186211560916'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/1024-x-768-with-20-path-subpx-and-2x2.html' title='1024 x 768 with 20 path /subpx and  2x2 subpixel'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe58uwHmoQjzkkbxx6K0cxIJASyMtp7R4z2ln6t2Qc7BBxDVfOUgLSabUZd5onblheQ14j8LQJvjMAhgD_1m0EGLT7tsaCxNH-EPgEvYQWZxv0_ymvYm-wpb3NaHgNraWRjYJm2u3xK6s/s72-c/test.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-1351393555849326458</id><published>2015-07-25T10:42:00.005+09:00</published><updated>2015-07-25T10:55:04.001+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="renderer"/><title type='text'>遅いのでAABBを導入してちょっとだけ早くする</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
簡単なレイトレができましたが，単純なシーンの割に遅いです．&lt;br /&gt;
先ほどの偽コーネルボックス(640x480)のレイキャストで約1.0秒もかかっています．&lt;br /&gt;
これは由々しき事態です！&lt;br /&gt;
&lt;br /&gt;
というわけで，本筋としてはBVHなどの高速な衝突検出（O(log(n)）を使うべきですが，&lt;br /&gt;
とりあえずAABBを導入します．&lt;br /&gt;
&lt;br /&gt;
AABBとは，Axis Aligned Bounding Boxの略で，要するに当たり判定用のBOXです．&lt;br /&gt;
ポイントはXYZ軸に沿っていることですね．そのため，斜め方向を向いている細長い物体だと，大きくなりすぎる問題もあります．&lt;br /&gt;
物体の向きに関係なく，任意方向の境界BOXであるOBB(Oriented Bounding Box)というものもありますが，OBB算出が面倒なのとシーンが複雑になった時の構築時間が増えてしまうので，今回は後々の拡張も考慮してAABBを採用します．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AABBの実装は簡単で，プリミティブの最小最大座標をx,y,zそれぞれ求めて上げればOKです．&lt;br /&gt;
現在，プリミティブとして用意しているのは，三角形と球なのでちょいちょいと求めてあげます．&lt;br /&gt;
&lt;br /&gt;
メッシュ（モデル）毎にもAABB持たせてあげましょう．&lt;br /&gt;
メッシュを構成する全プリミティブのAABBをガッチャンコします．&lt;br /&gt;
MergeAABBみたいな関数を用意すると便利ですね．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
次はAABBとレイとの衝突判定を実装します．&lt;br /&gt;
&lt;br /&gt;
とりあえずこれを参考にします．&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.amazon.co.jp/gp/product/493900791X/ref=as_li_ss_tl?ie=UTF8&amp;amp;camp=247&amp;amp;creative=7399&amp;amp;creativeASIN=493900791X&amp;amp;linkCode=as2&amp;amp;tag=closed-22&quot;&gt;ゲームプログラミングのためのリアルタイム衝突判定&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-jp.amazon-adsystem.com/e/ir?t=closed-22&amp;amp;l=as2&amp;amp;o=9&amp;amp;a=493900791X&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
サンプルコードが&lt;a href=&quot;http://www.borndigital.co.jp/book/164.html&quot;&gt;ここ（http://www.borndigital.co.jp/book/164.html）&lt;/a&gt;&amp;nbsp;からダウンロードできるので買わなくてもいいけれど，一冊持っていると良いと思います．&lt;br /&gt;
ちなみに，この本は学生の時にお世話になりました．&lt;br /&gt;
その当時は日本語版がなくて，英語を読むのに苦労した覚えがあります……；&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/1351393555849326458/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/aabb.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1351393555849326458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1351393555849326458'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/aabb.html' title='遅いのでAABBを導入してちょっとだけ早くする'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-594340287345954879</id><published>2015-07-25T10:42:00.002+09:00</published><updated>2015-07-25T10:55:04.014+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="renderer"/><title type='text'>単純なレイキャスティング</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
とりあえず，単純なレイキャスティングを行うプログラムを書いてみました．&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF5gtgPsPBqvd-P_Ib-_zzfSjjQRPAh9q4PdmDCu8eyjYMX59SK0HgmWXR85gqYN2wLAae9_thM6wUajeMVA4cC4LslOqnSDnoP1z_A4Klp9eNhCZiEP-Hg2a40cJYSwLKrgYP2AtoZG0/s1600/box.dae.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF5gtgPsPBqvd-P_Ib-_zzfSjjQRPAh9q4PdmDCu8eyjYMX59SK0HgmWXR85gqYN2wLAae9_thM6wUajeMVA4cC4LslOqnSDnoP1z_A4Klp9eNhCZiEP-Hg2a40cJYSwLKrgYP2AtoZG0/s320/box.dae.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBTVBQUl_cb4iqfXaXb5vWIw7HfEDr8Ri_lwSZBYk3hX0ENnqjKaLe5oSWb2EqpBavMJex7-zU1QVVWmcJv6V6wxE3uulHvAtgZcaSg5pjf7Y4ZoIxWxpVX6RPfZomkVtyMYSpreAotOU/s1600/imagex.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBTVBQUl_cb4iqfXaXb5vWIw7HfEDr8Ri_lwSZBYk3hX0ENnqjKaLe5oSWb2EqpBavMJex7-zU1QVVWmcJv6V6wxE3uulHvAtgZcaSg5pjf7Y4ZoIxWxpVX6RPfZomkVtyMYSpreAotOU/s320/imagex.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
シーンがしょぼいのと，光源を設定していないので陰影も出てませんが；&lt;br /&gt;
&lt;br /&gt;
でわでわ．</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/594340287345954879/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post_86.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/594340287345954879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/594340287345954879'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post_86.html' title='単純なレイキャスティング'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF5gtgPsPBqvd-P_Ib-_zzfSjjQRPAh9q4PdmDCu8eyjYMX59SK0HgmWXR85gqYN2wLAae9_thM6wUajeMVA4cC4LslOqnSDnoP1z_A4Klp9eNhCZiEP-Hg2a40cJYSwLKrgYP2AtoZG0/s72-c/box.dae.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-1578112670844456314</id><published>2015-07-25T10:40:00.004+09:00</published><updated>2015-07-25T10:55:04.005+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="renderer"/><title type='text'>使うライブラリ</title><content type='html'>こんにちは．@rootxです．&lt;br /&gt;
&lt;br /&gt;
今回はレイトレ作るのに使いそうなライブラリを選んでみたよ．&lt;br /&gt;
あ，C++です．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://glm.g-truc.net/&quot; target=&quot;_blank&quot;&gt;glm OpenGL Mathematics (http://glm.g-truc.net/)&lt;/a&gt;&lt;/h3&gt;
ベクトルとかマトリクスとか，いつも出てくる子たちですね．&lt;br /&gt;
普段ならフルスクラッチで書くこともあるけれど，今回はこのglmというライブラリを利用してみます．&lt;br /&gt;
特徴としては，ヘッダオンリライブラリで，GLSL風の機能が備わっていること．OpenGL系と&lt;br /&gt;
あんまり早くは無いはず．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;https://github.com/nothings/stb&quot; target=&quot;_blank&quot;&gt;stb single-file public domain libraries for C/C++ (https://github.com/nothings/stb)&lt;/a&gt;&lt;/h3&gt;
いろんなファイルフォーマットに対応したヘッダオンリライブラリ．&lt;br /&gt;
画像出力（PNG）に使うつもり．&lt;br /&gt;
読込みもできるので，テクスチャロードもできるかな．&lt;br /&gt;
# でもglmの開発者の作っているgliも良さそうなんですよね．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
&lt;a href=&quot;http://assimp.sourceforge.net/&quot; target=&quot;_blank&quot;&gt;assimp : Open Asset Import Library (http://assimp.sourceforge.net/)&lt;/a&gt;&lt;/h3&gt;
いろんなアセットを読込みたいときに使えるよ．&lt;br /&gt;
基本的なフォーマット(collada, obj, stl, ply)でエクスポートもできるみたい．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
とりあえずここまで．&lt;br /&gt;
他に使えそうなライブラリがあったら追加するよ．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: black; font-family: Times; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; margin: 0px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
でわでわ．&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/1578112670844456314/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post_25.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1578112670844456314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1578112670844456314'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post_25.html' title='使うライブラリ'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-2675855154280667024</id><published>2015-07-25T10:40:00.001+09:00</published><updated>2015-07-25T10:55:04.009+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="renderer"/><title type='text'>レイトレはじめます</title><content type='html'>こんにちは。@rootxです。&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
先日、ドワンゴがとっても興味深い人材募集を始めましたね。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
新しい時代のエンジニアについて&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &#39;Helvetica Neue Light&#39;, HelveticaNeue-Light, helvetica, arial, sans-serif;&quot;&gt;http://info.dwango.co.jp/recruit/beyondtheweb/index.html&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
【新規事業】3DCGエンジニア(正社員)&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://progres05.jposting.net/pgdwango/u/job.phtml?job_code=1015&quot;&gt;https://progres05.jposting.net/pgdwango/u/job.phtml?job_code=1015&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
具体的には次のような条件が示されてるよ。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;gt; ＜必須条件＞&lt;/div&gt;
&lt;div&gt;
&amp;gt; • プログラマブルシェーダの実装経験者&lt;/div&gt;
&lt;div&gt;
&amp;gt; • SIGGRAPHなどで発表された論文を元に実装をしたことのある方&lt;/div&gt;
&lt;div&gt;
&amp;gt; • 3DCGの分野で何か研究したいテーマを持っている方&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;gt; ＜歓迎条件＞&lt;/div&gt;
&lt;div&gt;
&amp;gt; • SIGGRAPHなどにおけるCG関連論文の発表経験者&lt;/div&gt;
&lt;div&gt;
&amp;gt; • 物理ベースのオフラインレンダリングを研究開発できる人&lt;/div&gt;
&lt;div&gt;
&amp;gt; • リアルタイムへの自動リトポロジーアルゴリズムや光学エフェクトの研究開発ができる人&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ドワンゴというと、やっぱりニコニコ動画のイメージが先行してるので、まさかこんなにガチな人材を求めるとは思っていなかった、というのが正直なところです。&lt;/div&gt;
&lt;div&gt;
3DCG関連でいうと、短期的には、WebGLやunityみたいなネットと相性の良いテクノロジを志向するかと考えていました。実際、ニコニ立体でそちら方面は手を出しているし。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
そんなわけで、普段は興味分野と関係ないお仕事をしてるから、グッときちゃったね。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
でも、全然実績がないから、どうしようかなと思ってたけど、折角なので今から実績を作れるか挑戦してみようと思います。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
でわでわ。&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/2675855154280667024/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2675855154280667024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2675855154280667024'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/blog-post.html' title='レイトレはじめます'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-183524214230591967</id><published>2015-06-20T10:49:00.000+09:00</published><updated>2015-07-25T10:54:48.399+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="glfw"/><category scheme="http://www.blogger.com/atom/ns#" term="oculus"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenGL"/><category scheme="http://www.blogger.com/atom/ns#" term="日本語訳"/><title type='text'>GLFW: Oculus Rift ガイド 日本語訳</title><content type='html'>&lt;h2&gt;
GLFW: Oculus Rift ガイド&lt;/h2&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.glfw.org/docs/latest/rift.html&quot; target=&quot;_blank&quot;&gt;Oculus Rift guide&lt;/a&gt;&amp;nbsp;の日本語訳です．途中．&lt;br /&gt;
http://www.glfw.org/docs/latest/rift.html&lt;br /&gt;
&lt;hr /&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
&lt;br /&gt;
このガイドは，&lt;a href=&quot;https://developer.oculus.com/documentation/&quot; style=&quot;color: #ff6600; text-decoration: none;&quot;&gt;Oculus PC SDK ドキュメント&lt;/a&gt;と GLFWのドキュメントとの間にあるギャップを埋めることを目的にしていて，それらを置き換えるものではありません．&lt;a class=&quot;el&quot; href=&quot;http://www.glfw.org/docs/latest/group__native.html&quot; style=&quot;color: #ff6600; font-weight: bold; text-decoration: none;&quot;&gt;ネイティブアクセス(&lt;/a&gt;&lt;a class=&quot;el&quot; href=&quot;http://www.glfw.org/docs/latest/group__native.html&quot; style=&quot;color: #ff6600; font-weight: bold; text-decoration: none;&quot;&gt;native access)&lt;/a&gt;の使用が必要で，LibOVR，プラットフォーム固有API，利用する開発環境に関してある程度慣れ親しんでいることを前提としています．&lt;br /&gt;
GLFWはLibOVRを明示的にはサポートしていませんが，テストはされていて，LibOVRとの相互運用についても実施中です（While GLFW has no explicit support for LibOVR, it is tested with and tries to interoperate well with it）．&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;dl class=&quot;section note&quot; style=&quot;background: linear-gradient(rgb(221, 250, 209) 0px, rgb(203, 247, 186) 100%) rgb(255, 255, 255); border-radius: 4px; border: 2px solid rgb(175, 229, 153); box-shadow: rgb(186, 245, 163) 0px 0px 32px inset; color: #1e5309; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px; margin: 1em 0px; padding: 1em; text-shadow: rgb(255, 255, 255) 0px 1px 1px;&quot;&gt;
&lt;dt style=&quot;font-weight: bold;&quot;&gt;Note&lt;/dt&gt;
&lt;dd style=&quot;margin-bottom: 6px;&quot;&gt;Oculus SDKの開発速度によって，このガイドは次の（GLFWの）リリース前に時代遅れになっていると思います． もしこのドキュメントがローカルにコピーされたものなら，最新の情報をGLFWウェブサイトでチェックしてください．ガイドのこの版は，Oculus SDK のバージョン0.4.4を対象として記述されています．&lt;/dd&gt;&lt;/dl&gt;
&lt;h1 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 25.2000007629395px; line-height: 22px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;/h1&gt;
&lt;h1 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 25.2000007629395px; line-height: 22px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_include&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;LibOVRとGLFWヘッダファイルのインクルード&lt;/h1&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
OpneGL LibOVRヘッダとGLFWのネイティブヘッダの両方で，ビルドしようとしているOSが何かを伝えるマクロが必要です．LibOVRは主要なデスクトッププラットフォームだけをサポートしているため，標準的な事前定義マクロで解決できます．&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #007899;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: transparent; color: #007899;&quot;&gt;#if defined(_WIN32)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;fragment&quot; style=&quot;background: rgb(242, 242, 242); border-left-color: rgb(204, 204, 204); border-left-width: 4px; border-radius: 4px; border-style: none none none solid; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px; margin: 1em 0px; overflow: auto; padding: 1em;&quot;&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define GLFW_EXPOSE_NATIVE_WIN32&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define GLFW_EXPOSE_NATIVE_WGL&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define OVR_OS_WIN32&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#elif defined(__APPLE__)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define GLFW_EXPOSE_NATIVE_COCOA&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define GLFW_EXPOSE_NATIVE_NSGL&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define OVR_OS_MAC&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#elif defined(__linux__)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define GLFW_EXPOSE_NATIVE_X11&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define GLFW_EXPOSE_NATIVE_GLX&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt; #define OVR_OS_LINUX&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#include &amp;lt;&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/glfw3_8h.html&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;GLFW/glfw3.h&lt;/a&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#include &amp;lt;&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/glfw3native_8h.html&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;GLFW/glfw3native.h&lt;/a&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#include &amp;lt;OVR_CAPI_GL.h&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
&lt;br /&gt;
GLFWとLibOVRのヘッダ両方は，デフォルトで標準のOpenGL &amp;nbsp;&lt;code style=&quot;background: rgb(242, 242, 242); border-radius: 4px; padding: 0.1em;&quot;&gt;GL/gl.h&lt;/code&gt;&amp;nbsp;ヘッダ (&lt;code style=&quot;background: rgb(242, 242, 242); border-radius: 4px; padding: 0.1em;&quot;&gt;OpenGL/gl.h&lt;/code&gt;&amp;nbsp;on OS X)のインクルードを試みます．もし異なる標準ヘッダや&lt;a class=&quot;el&quot; href=&quot;http://www.glfw.org/docs/latest/context.html#context_glext_auto&quot; style=&quot;color: #ff6600; font-weight: bold; text-decoration: none;&quot;&gt;GL拡張ロードライブラリ&lt;/a&gt;を使いたい場合は，これらの記述の前にインクルードしてください．&lt;/div&gt;
&lt;h1 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 25.2000007629395px; line-height: 22px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_init&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;LibOVRとGLFWの初期化&lt;/h1&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
LibOVRはGLFWより前に初期化される必要があります．つまり少なくとも&amp;nbsp;&lt;code style=&quot;background: rgb(242, 242, 242); border-radius: 4px; padding: 0.1em;&quot;&gt;ovr_Initialize&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background: rgb(242, 242, 242); border-radius: 4px; padding: 0.1em;&quot;&gt;ovrHmd_Create&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background: rgb(242, 242, 242); border-radius: 4px; padding: 0.1em;&quot;&gt;ovrHmd_ConfigureTracking&lt;/code&gt;&amp;nbsp;を&lt;a class=&quot;el&quot; href=&quot;http://www.glfw.org/docs/latest/group__init.html#ga317aac130a235ab08c6db0834907d85e&quot; style=&quot;color: #ff6600; font-weight: bold; text-decoration: none;&quot;&gt;glfwInit&lt;/a&gt;&amp;nbsp;より前に呼び出すことを意味します．同様に，GLFWより後にLibOVRを終了しければなりません．&lt;br /&gt;
これは，&lt;code style=&quot;background: rgb(242, 242, 242); border-radius: 4px; padding: 0.1em;&quot;&gt;ovrHmd_Destroy,&lt;/code&gt;&amp;nbsp;&lt;code style=&quot;background: rgb(242, 242, 242); border-radius: 4px; padding: 0.1em;&quot;&gt;ovr_Shutdown&lt;/code&gt;&amp;nbsp;を&amp;nbsp;&lt;a class=&quot;el&quot; href=&quot;http://www.glfw.org/docs/latest/group__init.html#gaaae48c0a18607ea4a4ba951d939f0901&quot; style=&quot;color: #ff6600; font-weight: bold; text-decoration: none;&quot;&gt;glfwTerminate&lt;/a&gt;の後に呼ぶことを意味します．&lt;/div&gt;
&lt;h1 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 25.2000007629395px; line-height: 22px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_direct&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;Direct HMD モード&lt;/h1&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
Direct HMDモードは，新しいアプリケーションで推奨されている表示モードですが，Oculus Riftランタイムは現在（2015年1月時点）Windowsだけがこのモードをサポートしています．Direct HMDモードでは，HMDはGLFWモニターとして検出されません．&lt;/div&gt;
&lt;h2 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 19.6000003814697px; line-height: 22px; margin-bottom: 0px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_direct_create&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;ウィンドウとコンテキストの作成&lt;/h2&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
もし、HMDがダイレクトモードならフルスクリーンモードかウィンドウモードのどちらかを使用できますが、フルスクリーンはHMDの解像度をサポートしている場合だけ推奨されます。&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
LibOVRの制限のため、ウィンドウのクライアントエリアのサイズとHMDの解像度は必ず一致してなければなりません。&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
もしHMDの解像度が通常のモニタ解像度より大きい場合、&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
If the resolution of the HMD is much larger than the regular monitor, the window may be resized by the window manager on creation. One way to avoid this is to make it undecorated with the&amp;nbsp;&lt;a class=&quot;el&quot; href=&quot;http://www.glfw.org/docs/latest/window.html#window_hints_wnd&quot; style=&quot;color: #ff6600; font-weight: bold; text-decoration: none;&quot;&gt;GLFW_DECORATED&lt;/a&gt;&amp;nbsp;window hint.&lt;/div&gt;
&lt;h2 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 19.6000003814697px; line-height: 22px; margin-bottom: 0px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_direct_attach&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;HMDへのウィンドウのアタッチ&lt;/h2&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
Once you have created the window and context, you need to attach the native handle of the GLFW window to the HMD.&lt;/div&gt;
&lt;div class=&quot;fragment&quot; style=&quot;background: rgb(242, 242, 242); border-left-color: rgb(204, 204, 204); border-left-width: 4px; border-radius: 4px; border-style: none none none solid; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px; margin: 1em 0px; overflow: auto; padding: 1em;&quot;&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
ovrHmd_AttachToWindow(hmd, &lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__native.html#gafe5079aa79038b0079fc09d5f0a8e667&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetWin32Window&lt;/a&gt;(window), NULL, NULL);&lt;/div&gt;
&lt;/div&gt;
&lt;h1 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 25.2000007629395px; line-height: 22px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_extend&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;拡張デスクトップ(Extend Desktop) モード&lt;/h1&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
拡張デスクトップモードは旧来の表示モードですが，OS XやLinux上では，技術的な理由でDirect HMDモードをサポートされていないため，このモードだけが利用可能です（2015年1月時点）．Windows機でも同様に．&lt;/div&gt;
&lt;h2 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 19.6000003814697px; line-height: 22px; margin-bottom: 0px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
GLFWでHMDを検出する&lt;/h2&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
HMDが拡張デスクトップモードになっている場合，どちらのGLFWモニタがHMDと一致しているかを推定して，そのモニタにフルスクリーンウィンドウを作成します．&lt;br /&gt;
Windowsでは，GLFWモニタのネイティブデバイス名は，検出されたHDMのディスプレイデバイス名と対応しています（&lt;span style=&quot;font-family: monospace;&quot;&gt;ovrHmdDescの&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;DisplayDeviceNameメンバに保持されています&lt;/span&gt;）．&lt;br /&gt;
OSX上では，GLFWモニタのネイティブディスプレイIDが検出されたHMDのディスプレイIDに対応しています（of&lt;code style=&quot;background: rgb(242, 242, 242); border-radius: 4px; padding: 0.1em;&quot;&gt;ovrHmdDescの&lt;/code&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;DisplayIdメンバに保持されています&lt;/span&gt;）．&lt;br /&gt;
&lt;br /&gt;
執筆時点（2015年1月）で，Oculus SDKはどちらのモニタがHMDなのかをちゃんとした方法で検出する方法はサポートしていませんが，&lt;br /&gt;
HMDが適切にセットアップと回転されている限り，LibOVRによって提供されるスクリーン位置と解像度を通じて発見することができます．&lt;br /&gt;
この方法はHMDをミラリングしている他のモニタを見つけてしまうかもしれませんが，もしそのビデオモードを変更使用としている場合にだけ問題となります．&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;fragment&quot; style=&quot;background: rgb(242, 242, 242); border-left-color: rgb(204, 204, 204); border-left-width: 4px; border-radius: 4px; border-style: none none none solid; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px; margin: 1em 0px; overflow: auto; padding: 1em;&quot;&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keywordtype&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;int&lt;/span&gt; i, count;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__monitor.html#ga8d9efd1cde9426692c73fe40437d0ae3&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;GLFWmonitor&lt;/a&gt;** monitors = &lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__monitor.html#ga3fba51c8bd36491d4712aa5bd074a537&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetMonitors&lt;/a&gt;(&amp;amp;count);&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keywordflow&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;for&lt;/span&gt; (i = 0;  i &amp;lt; count;  i++)&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
{&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#if defined(_WIN32)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;    &lt;span class=&quot;keywordflow&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;if&lt;/span&gt; (strcmp(&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__native.html#gac408b09a330749402d5d1fa1f5894dd9&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetWin32Monitor&lt;/a&gt;(monitors[i]), hmd-&amp;gt;DisplayDeviceName) == 0)&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keywordflow&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;return&lt;/span&gt; monitors[i];&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#elif defined(__APPLE__)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;    &lt;span class=&quot;keywordflow&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;if&lt;/span&gt; (&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__native.html#gaf22f429aec4b1aab316142d66d9be3e6&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetCocoaMonitor&lt;/a&gt;(monitors[i]) == hmd-&amp;gt;DisplayId)&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keywordflow&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;return&lt;/span&gt; monitors[i];&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#elif defined(__linux__)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;    &lt;span class=&quot;keywordtype&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;int&lt;/span&gt; xpos, ypos;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keyword&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;const&lt;/span&gt; &lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/structGLFWvidmode.html&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;GLFWvidmode&lt;/a&gt;* mode = &lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__monitor.html#gafc1bb972a921ad5b3bd5d63a95fc2d52&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetVideoMode&lt;/a&gt;(monitors[i]);&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__monitor.html#ga102f54e7acc9149edbcf0997152df8c9&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetMonitorPos&lt;/a&gt;(monitors[i], &amp;amp;xpos, &amp;amp;ypos);&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keywordflow&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;if&lt;/span&gt; (hmd-&amp;gt;WindowsPos.x == xpos &amp;amp;&amp;amp;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
hmd-&amp;gt;WindowsPos.y == ypos &amp;amp;&amp;amp;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
hmd-&amp;gt;Resolution.w == mode-&amp;gt;&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/structGLFWvidmode.html#a698dcb200562051a7249cb6ae154c71d&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;width&lt;/a&gt; &amp;amp;&amp;amp;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
hmd-&amp;gt;Resolution.h == mode-&amp;gt;&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/structGLFWvidmode.html#ac65942a5f6981695517437a9d571d03c&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;height&lt;/a&gt;)&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
{&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keywordflow&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;return&lt;/span&gt; monitors[i];&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
}&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#endif&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h2 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 19.6000003814697px; line-height: 22px; margin-bottom: 0px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_extend_create&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;ウィンドウとコンテキストの作成&lt;/h2&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
&lt;div style=&quot;font-family: Roboto, sans-serif;&quot;&gt;
検出されたモニタ上に通常のフルスクリーンウィンドウとして，ウィンドウが作成されます．HMDが正しいビデオモードに既に設定されている場合には，&lt;a class=&quot;el&quot; href=&quot;http://www.glfw.org/docs/latest/window.html#window_windowed_full_screen&quot; style=&quot;color: #ff6600; font-weight: bold; text-decoration: none;&quot;&gt;windowed full screen&lt;/a&gt;ウィンドウを作成することは通常良いアイディアです．しかし，拡張デスクトップモードは通常のモニタとして振る舞い，いくつかのサポートされているビデオモードの受付け可能です．&lt;/div&gt;
&lt;div style=&quot;font-family: Roboto, sans-serif;&quot;&gt;
もし他のモニタだがHDMをミラリングしていて，異なるビデオモードをリクエストしている場合，すべてのミラリング設定されているモニタは新しいビデオモードになります．&lt;/div&gt;
&lt;h1 style=&quot;font-family: Roboto, sans-serif;&quot;&gt;
HMDへのレンダリング&lt;/h1&gt;
&lt;h2 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 19.6000003814697px; line-height: 22px; margin-bottom: 0px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_render_sdk&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;SDK歪曲レンダリング&lt;/h2&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
&lt;div style=&quot;font-family: Roboto, sans-serif;&quot;&gt;
もしSDK歪曲（ディストーション）レンダリングを使おうとするなら，レンダラを設定するためにGLFWからいくつかの情報を取り出す必要があります．&lt;/div&gt;
&lt;span style=&quot;font-family: Roboto, sans-serif;&quot;&gt;GLFWから情報を埋める必要のある ovr&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;GLConfig ユニオンの一部を示します．&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;他のフィールドも&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;ovrHmd_ConfigureRenderingのために設定する必要があることに注意してください．&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;SDKディストーションレンダリングを設定する前に，あなたのコンテキストをカレントにしてください．&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Roboto, sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;fragment&quot; style=&quot;background: rgb(242, 242, 242); border-left-color: rgb(204, 204, 204); border-left-width: 4px; border-radius: 4px; border-style: none none none solid; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px; margin: 1em 0px; overflow: auto; padding: 1em;&quot;&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keywordtype&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;int&lt;/span&gt; width, height;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;keyword&quot; style=&quot;color: #404040; font-weight: bold;&quot;&gt;union &lt;/span&gt;ovrGLConfig config;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__window.html#ga0e2637a4161afb283f5300c7f94785c9&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetFramebufferSize&lt;/a&gt;(window, &amp;amp;width, &amp;amp;height);&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
config.OGL.Header.BackBufferSize.w = width;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
config.OGL.Header.BackBufferSize.h = height;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#if defined(_WIN32)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;    config.OGL.Window = &lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__native.html#gafe5079aa79038b0079fc09d5f0a8e667&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetWin32Window&lt;/a&gt;(window);&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#elif defined(__APPLE__)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#elif defined(__linux__)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;&lt;/span&gt;    config.OGL.Disp = &lt;a class=&quot;code&quot; href=&quot;http://www.glfw.org/docs/latest/group__native.html#ga8519b66594ea3ef6eeafaa2e3ee37406&quot; style=&quot;color: #e64500; text-decoration: none;&quot;&gt;glfwGetX11Display&lt;/a&gt;();&lt;/div&gt;
&lt;div class=&quot;line&quot; style=&quot;-webkit-transition-duration: 0.5s; -webkit-transition-property: background-color, box-shadow; font-family: monospace, fixed; font-size: 13px; font-stretch: normal; line-height: inherit; margin: 0px; min-height: 13px; padding-bottom: 0px; padding-left: 53px; text-indent: -53px; transition-duration: 0.5s; transition-property: background-color, box-shadow; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;
&lt;span class=&quot;preprocessor&quot; style=&quot;color: #007899;&quot;&gt;#endif&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
&lt;br /&gt;
SDKディストーションレンダリングを使う場合，ovrHmd_EndFrameによってHMDが更新されたときに，自分でバッファスワップをしてはいけません．&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;-webkit-transition: text-shadow 0.5s linear; background-color: white; border-bottom-style: none; color: #1a1a1a; font-family: Roboto, sans-serif; font-size: 19.6000003814697px; line-height: 22px; margin-bottom: 0px; margin-right: 15px; padding-top: 0.5em; transition: text-shadow 0.5s linear;&quot;&gt;
&lt;a class=&quot;anchor&quot; href=&quot;https://www.blogger.com/null&quot; id=&quot;rift_render_custom&quot; style=&quot;color: #ff6600; font-weight: normal;&quot;&gt;&lt;/a&gt;クライアント歪曲レンダリング&lt;/h2&gt;
&lt;div style=&quot;background-color: white; color: #4d4d4d; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 22px;&quot;&gt;
クライアント側で歪曲レンダリングするときは，HMDのコンテンツを完全な制御下におき，通常のレンダリングとバッファスワップを実施します．&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/183524214230591967/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2015/07/glfw-oculus-rift.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/183524214230591967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/183524214230591967'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2015/07/glfw-oculus-rift.html' title='GLFW: Oculus Rift ガイド 日本語訳'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-4324917084772105011</id><published>2014-09-07T23:36:00.000+09:00</published><updated>2014-09-07T23:36:06.009+09:00</updated><title type='text'>MacBook Pro Retina, Mid 2012でOculus DK2を動かす</title><content type='html'>&lt;h2&gt;
はじめに&lt;/h2&gt;
みなさんOculus Rift DK2 活用していますか？&lt;br /&gt;
高スペックPCを所有していないので，かるーいやつしか動かせていません．&lt;br /&gt;
&lt;br /&gt;
SDKがver 0.4.1でosxにも対応されましたので，MBP retinaとりあえず動かしてみた次第です．※ 現時点（2014/09/07）の最新SDKは ver0.4.2です．&lt;br /&gt;
&lt;br /&gt;
導入にあたりいくつか戸惑った点があったので，記録しておきます．&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
利用したもの&lt;/h3&gt;
&lt;h4&gt;
MacBook Pro Retina, Mid 2012&lt;/h4&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Processor&lt;/b&gt;&amp;nbsp; 2.6 GHz Intel Core i7&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Memory&lt;/b&gt;&amp;nbsp; 16 GB 1600 MHz DDR3&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Graphics&lt;/b&gt;&amp;nbsp; NVIDIA GeForce GT 650M 1024 MB&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Software&lt;/b&gt;&amp;nbsp; OS X 10.9.4&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Oculus Rift&lt;/h4&gt;
&lt;div&gt;
Oculus Rift DK2 本体（HDM，カメラ）&lt;br /&gt;Oculus SDK v 0.4.2 Beta (&lt;a href=&quot;https://developer.oculusvr.com/?action=dl&quot; target=&quot;_blank&quot;&gt;https://developer.oculusvr.com/?action=dl&lt;/a&gt;)&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Oculus Runtime for Mac OS&lt;/li&gt;
&lt;li&gt;Oculus SDK for Mac OS&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
導入方法&lt;/h2&gt;
&lt;div&gt;
&lt;h3&gt;
接続&lt;/h3&gt;
oculus DK2本体およびトラッキング用カメラを接続します．&lt;/div&gt;
&lt;div&gt;
本体直挿しで，外部電源は不要でした．&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
Oculus Runtime for Mac OSのインストール&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
ドライバを入れないと認識しないので，上述のOculus Runtime for Mac OSをインストールします．dmgになっているので，叩くとマウントされます．&lt;br /&gt;
&lt;br /&gt;
最近のosxはセキュリティが厳しいのでそのままでは動かないので，oculus_runtime_rev_1_sdk_0.4.2_osx.app を右クリックして「Open」から実行してください．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
※ 多分私だけだと思いますが，ここでRuntimeのdmgを叩いてもインストーラが強制終了するという，不可解なエラーに遭遇しました．&lt;/div&gt;
&lt;div&gt;
原因はよく分かりませんが，ログ的にはメモリ確保にしくじっていました．&lt;/div&gt;
&lt;div&gt;
ググってみたのですが，英語圏でもそのような問題は出ていないようで，対処方法が見つかりませんでした．&lt;/div&gt;
&lt;div&gt;
結局，OSを再インストールしたら動くようになりました．&lt;br /&gt;
（OSのみ再インストールで，データはすべて残った状態で再インストールできたので良かったです…）&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h3&gt;
ファームウェア更新&lt;/h3&gt;
&lt;div&gt;
firmware が最新じゃない場合は，最新にしておきます．（2014/09/07時点では，2.12です）&lt;/div&gt;
&lt;div&gt;
設定ユーティリティ (/Applications/Oculus/Tools/OculusConfigUtil.app)を起動して，メニューのTools/Advanced/Update firmware...から次のファイルを選択します．&lt;/div&gt;
&lt;div&gt;
/Applications/Oculus/Tools/Firmware/DK2/DK2Firmware_2_12.ovrf&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
画面の設定&lt;/h3&gt;
ランタイムをインストールできたら，次はHMDの電源を入れて動作確認です．&lt;br /&gt;
osxの場合は，Extendモード（？）では動かないので，セカンドモニタとして認識されます．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ただい，接続しても画面周りがよく分からないことになっているので次の方法をとりました．&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;osxの画面設定（Preferences/Display）を ⌘+altを押しながらクリックして開く（画面の回転を有効にするため）&lt;/li&gt;
&lt;li&gt;アレンジメントタブへ移り，画面のミラーを無効にする．&lt;/li&gt;
&lt;li&gt;&quot;Gather windows&quot;ボタンをクリック（言語環境が英語の場合．日本語だと何か不明）&lt;/li&gt;
&lt;li&gt;出てきた画面で，90°回転にして，default/native解像度を選ぶ&lt;/li&gt;
&lt;li&gt;画面設定に戻って，ミラーを有効にする．（メイン画面の色が変になるけどそういうもんらしいです）&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
（参考URL: http://www.reddit.com/r/oculus/comments/2dbxve/041_with_dk2_on_a_mac_incompatible_resolution/）&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
あとは適当なデモを起動してoculusライフを楽しんでください！&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
所感&lt;/h2&gt;
どうにか，MBPでOculus DK2を動かせました．&lt;br /&gt;
とりあえず動くという感じ．重い奴はFPSが出ないので酔いが厳しい．&lt;br /&gt;
&lt;br /&gt;
osx対応のデモはまだ少ないので見つけにくいと思いますが，だんだん増えてくることと思います．Matrixのやつ(http://www.tipatat.com/TheMatrixVR/)はosx版もありました．ジャンプが成功しませんのでコツがあれば教えて欲しいです……．&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
だいたいのデモは，PS3コントローラで操作できるっぽいので一つ買っておくと良いです．&lt;br /&gt;
多分Xbox360のコントローラでも大丈夫だと思いますが，所持していないためosxで動作するか不明です．readme.txtにはxboxコントローラの説明ばかりなのですよね．&lt;br /&gt;
ちなみにPS3コントローラの場合は，ドライバなど不要で，BluetoothをONにするだけで使えます．&lt;br /&gt;
&lt;br /&gt;
&lt;iframe frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://rcm-fe.amazon-adsystem.com/e/cm?lt1=_blank&amp;amp;bc1=FFFFFF&amp;amp;IS2=1&amp;amp;bg1=FFFFFF&amp;amp;fc1=000000&amp;amp;lc1=0000FF&amp;amp;t=closed-22&amp;amp;o=9&amp;amp;p=8&amp;amp;l=as4&amp;amp;m=amazon&amp;amp;f=ifr&amp;amp;ref=ss_til&amp;amp;asins=B000X1YEU8&quot; style=&quot;height: 240px; width: 120px;&quot;&gt;&lt;/iframe&gt;

</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/4324917084772105011/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2014/09/macbook-pro-retina-mid-2012oculus-dk2.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/4324917084772105011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/4324917084772105011'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2014/09/macbook-pro-retina-mid-2012oculus-dk2.html' title='MacBook Pro Retina, Mid 2012でOculus DK2を動かす'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-2035797911707036149</id><published>2014-08-20T00:22:00.001+09:00</published><updated>2014-08-20T22:58:42.587+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="glfw"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenGL"/><category scheme="http://www.blogger.com/atom/ns#" term="日本語訳"/><title type='text'>GLFWマルチモニタガイド 日本語訳</title><content type='html'>&lt;h2&gt;
GLFWマルチモニタガイド&amp;nbsp;&lt;/h2&gt;
&lt;div&gt;
&lt;div style=&quot;font-size: medium; font-weight: normal;&quot;&gt;
&lt;a href=&quot;http://www.glfw.org/docs/latest/monitor.html&quot; target=&quot;_blank&quot;&gt;GLFW: Multi-monitor guide http://www.glfw.org/docs/latest/monitor.html&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: medium; font-weight: normal;&quot;&gt;
の勝手な日本語訳です．&lt;/div&gt;
&lt;div style=&quot;font-size: medium; font-weight: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: medium; font-weight: normal;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;hr /&gt;
&lt;h2&gt;
モニタオブジェクト&lt;/h2&gt;
GLFWmonitorオブジェクトは現在接続されているモニタを表現します。&lt;br /&gt;
&lt;h2&gt;
モニタの取得&lt;/h2&gt;
プライマリモニタはglfwGetPrimaryMonitorで返されます。
通常、ユーザの優先モニタで、タスクバーやメニューバーのようなグローバルUI要素を備えています。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;GLFWmonitor* primary = glfwGetPrimaryMonitor();
&lt;/code&gt;&lt;/pre&gt;
glfwGetMonitorsで、接続されているすべてのモニタを取得できます。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;int count;
GLFWmonitor** monitors = glfwGetMonitors(&amp;amp;count);
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;
ビデオモードの取得&lt;/h2&gt;
GLFWは通常、フルスクリーンウィンドウを開く際に適切なビデオモードを選択してくれますが、あるシステムで正確にどのモードが利用可能であるかを知ることは時々役立ちます。
例えば、ビデオモードの一覧をユーザに提示して、そこから選ばせるような場合です。
利用可能なビデオモードの一覧を取得するには、関数glfwGetVideoModesを使うことができます。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;int count;
GLFWvidmode* modes = glfwGetVideoModes(monitor, &amp;amp;count);
&lt;/code&gt;&lt;/pre&gt;
モニタの現在のビデオモードを取得するには、glfwGetVideoModeを呼び出してください。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;const GLFWvidmode* mode = glfwGetVideoMode(monitor);
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;
モニタの物理サイズ&lt;/h2&gt;
モニタのミリメータ単位の物理的な大きさ、あるいはその近似値は、glfwGetMonitorPhysicalSizeで取得できます。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;int widthMM, heightMM;
glfwGetMonitorPhysicalSize(monitor, &amp;amp;widthMM, &amp;amp;heightMM);
&lt;/code&gt;&lt;/pre&gt;
例えば、これによって、現在のビデオモードと合わせて、モニタのDPIを計算することができます。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;const double dpi = mode-&amp;gt;width / (widthMM / 25.4);
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;
モニタ名&lt;/h2&gt;
glfwGetMonitorNameでモニタ名を取得できます。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;const char* name = glfwGetMonitorName(monitor);
&lt;/code&gt;&lt;/pre&gt;
モニタ名は、UTF–8エンコーディングのC文字列です。
モニタ名は一意とは限らないことに注意してください。&lt;br /&gt;
&lt;h2&gt;
モニタのガンマランプ&lt;/h2&gt;
モニタのガンマランプはglfwSetGammaRampでセットすることができ、モニタハンドルとGLFWgammaramp構造体へのポインタを受け付けます。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwSetGammaRamp(monitor, &amp;amp;ramp);
&lt;/code&gt;&lt;/pre&gt;
モニタの現在のガンマランプは、glfwGetGammaRampで受け取れます。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;const GLFWgammaramp* ramp = glfwGetGammaRamp(monitor);
&lt;/code&gt;&lt;/pre&gt;
一般的なガンマランプをセットしたいなら、glfwSetGammaで望みの指数からGLFWにそれを算出させることができ、それは結果のランプでglfwSetGammaRampを順に呼び出します。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwSetGamma(monitor, 1.0);
&lt;/code&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/2035797911707036149/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2014/08/glfw.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2035797911707036149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2035797911707036149'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2014/08/glfw.html' title='GLFWマルチモニタガイド 日本語訳'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-2405942570606144954</id><published>2014-07-20T11:31:00.000+09:00</published><updated>2014-07-24T20:38:22.215+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="glfw"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenGL"/><category scheme="http://www.blogger.com/atom/ns#" term="日本語訳"/><title type='text'>GLFW3の新機能</title><content type='html'>&lt;h2&gt;
V3.0の新機能&lt;/h2&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.glfw.org/docs/latest/news.html&quot; target=&quot;_blank&quot;&gt;New features in version 3.0 http://www.glfw.org/docs/latest/news.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/div&gt;
&lt;h3&gt;
CMakeビルドシステム&lt;/h3&gt;
&lt;div class=&quot;p3&quot;&gt;以前バージョンのGLFWでは各種makefileやプロジェクトファイルを利用していましたが、それ代わって，CMakeビルドシステムを使うようになりました．CMakeはGLFWがサポートするすべてのプラットフォームで利用可能で，ほとんどのパッケージシステムで提供されており，ほとんどのメジャーな開発環境用のmakefileやプロジェクトファイルを生成できます．&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
CMakeの使い方に関する詳しい情報は，CMakeのマニュアルを参照してください．&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
&lt;br&gt;&lt;/div&gt;
&lt;h3&gt;
マルチウィンドウサポート&lt;/h3&gt;
&lt;div class=&quot;p4&quot;&gt;
GLFWは複数のウィンドウ生成をサポートしました．各ウィンドウは、それぞれがOpenGLまたはOpenGL ESコンテキストを所有し，すべてのウィンドウ関数はウィンドウハンドルを持ちます．イベントコールバックはウィンドウ毎になり，イベントを受信したウィンドウのハンドルも渡されるようになっています．与えたスレッド上の現在のコンテキストを選択するためにglfwMakeContextCurrent関数が追加されています．&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
&lt;br&gt;&lt;/div&gt;
&lt;h3&gt;
マルチモニタのサポート&lt;/h3&gt;
&lt;div class=&quot;p5&quot;&gt;
GLFW&lt;span class=&quot;s5&quot;&gt;はマルチモニタをきちんとサポートします．glfwGetMonitors&lt;span class=&quot;s5&quot;&gt;で列挙することができ，各種の取得にはglfwGetVideoModes, glfwGetMonitorPos, glfwGetMonitorName, glfwGetMonitorPhysicalSizeを使います。また、特定の&lt;span class=&quot;s5&quot;&gt;モニタにフルスクリーンウィンドウ表示するための指定が可能になっています．&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p5&quot;&gt;
&lt;span class=&quot;s5&quot;&gt;&lt;br&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3&gt;
Unicode&lt;span class=&quot;s6&quot;&gt;のサポート&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;p3&quot;&gt;
GLFW関数へ渡されるすべての文字列引数と戻り値は，UTF-8エンコーディングを使うようになりました．（ASCIIはUTF-8のサブセットなので）拡張関数引数はもちろんのこと，ウィンドウタイトル，エラー文字列，クリップボードテキスト，モニタやジョイスティック名を含みます．&lt;/div&gt;
&lt;div class=&quot;p7&quot;&gt;
&lt;br&gt;&lt;/div&gt;
&lt;h3&gt;
クリップボードテキストI/O&lt;/h3&gt;
&lt;div class=&quot;p4&quot;&gt;
GLFWは、システムクリップボードへの&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); &quot;&gt;プレーンテキストの&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); &quot;&gt;書込みおよび読込みをサポートしました．これには，glfwGetClipboardString とglfwSetClipboardString関数を使います．&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
ガンマランプのサポート&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p3&quot;&gt;
GLFWはモニタのガンマランプの設定と読取りをサポートします．これにはglfwGetGammaRampとglfwSetGammaRamp関数を使います．ガンマ値からランプを生成して設定するglfwSetGammaもあります．&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
（訳注: ガンマランプとは、「各色成分の強さの段階ごとのガンマ補正後の実際に出力される強さの値」を順に並べた配列で，ガンマ補正のパラメータのようなもの，という認識です）&lt;/div&gt;
&lt;div class=&quot;p6&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
OpenGL ES&lt;span class=&quot;s6&quot;&gt;のサポート&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
GLFWはOpenGL ESコンテキストの作成をサポートするようになりました．GLFW_CLIENT_APIウィンドウヒントをGLFW_OPENGL_ES_APIへセットすることによって、OpenGL ESコンテキストの生成がサポートされます．GLFWはOpenGL ES自体を実装しているわけではないので，使っているドライバがGLFWで利用できる方法のサポートを提供しなければならないことに注意してください．最近のnVIDIAとintelドライバはGLXとWGL APIを用いることでOpenGL ESコンテキストの生成をサポートしていますが，AMDはEGL実装を代わりに提供しています．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
（実験的な）EGLサポート&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
GLFWは，CMakeオプションで選択できる，実験的なEGLコンテキスト生成バックエンドを持ちます．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
高解像度モニタのサポート&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
GLFWはWindowsとOS Xの両方で高DPIモニタをサポートします．これは，フル解像度のフレームバッファを与えますが，他のUI要素はスケールアップされます．これを実現するために，glfwGetFramebufferSizeとglfwSetFramebufferSizeCallbackが追加されました．これらはピクセルで動作し，残りのGLFW APIはスクリーン座標で動作します．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
エラーコールバック&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
GLFWは，より詳細な診断情報をアプリケーションへ渡せるエラーコールバックを提供するようになりました．コールバックにはエラーコードと詳細文字列が渡されます．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
ウィンドウ単位のユーザポインタ&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
各ウィンドウはユーザ定義ポインタを持つようになりました．&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-tap-highlight-color: rgba(26, 26, 26, 0.292969); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); &quot;&gt;GLFWを&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); &quot;&gt;C++コードへ統合するのをもっと簡単にするために，glfwGetWindowUserPointerで受け取り，glfwSetWindowUserPointerで設定します．&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
ウィンドウのアイコン化コールバック&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
各ウィンドウはアイコン化とその復元イベントのコールバックを持っています．それは glfwSetWindowIconifyCallbackで設定できます．&lt;/div&gt;&lt;div class=&quot;p4&quot;&gt;&lt;br&gt;&lt;/div&gt;&lt;div class=&quot;p2&quot;&gt;
&lt;h3&gt;
ウィンドウ位置コールバック&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
各ウィンドウは，位置イベントのコールバックを備えました．glfwSetWindowPosCallbackで設定できます．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
ウィンドウ位置クエリ&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
ウィンドウ位置をglfwGetWindowPosで取得できるようになりました．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
ウィンドウフォーカスコールバック&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
各ウィンドウはフォーカスイベントコールバックを備えました．glfwSetWindowFocusCallbackで設定できます．&lt;/div&gt;&lt;div class=&quot;p6&quot;&gt;&lt;br&gt;
&lt;h3&gt;
&lt;span class=&quot;s6&quot;&gt;
&lt;span class=&quot;s6&quot;&gt;カーソル enter/leave &lt;span class=&quot;s6&quot;&gt;コールバック&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span class=&quot;s6&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
各ウィンドウはマウスカーソルがクライアントエリアに入ってきた、あるいは、出て行った時のためのコールバックを持っています． glfwSetCursorEnterCallbackで設定できます．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
初期ウィンドウタイトル&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
作成時にウィンドウタイトルを指定できるようになりました．glfwCreateWindowの引数の一つとして設定します．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
隠しウィンドウ&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
ウィンドウはglfwHideWindowで非表示に，glfwShowWindowで表示できるようになりました．作成時の初期値として非表示にする場合は，GLFW_VISIBLEウィンドウヒントを使います．スクリーンに表示される前に指定した位置へウィンドウを動かすのと同じように，ほとんどのドライバで互換性のあるオフスクリーンレンダリングの実現方法です．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
装飾なしウィンドウ&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
装飾（つまり，フレームやタイトルバーのようなもの）なしのウィンドウモードのウィンドウを作成できるようになりました．GLFW_DECORATEDウィンドウヒントを使います．スプラッシュスクリーンのようなものを作成できます．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
修飾キービットマスク&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
修飾キービットマスクのパラメータが，マウスボタンコールバックとキーコールバックに追加されました．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
プラットフォーム依存スキャンコード&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
スキャンコードパラメータがキーコールバックに追加されました．キートークンを持たないキーでも，GLFW_KEY_UNKNOWNに設定されたパラメータとして渡されて取得可能になっています．これらのスキャンコードは端末によって様々で，キーバインディングのために利用される予定です．&lt;/div&gt;
&lt;div class=&quot;p2&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
ジョイスティック名&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p4&quot;&gt;
ジョイスティック名をglfwGetJoystickNameで取得できるようになりました．&lt;/div&gt;
&lt;div class=&quot;p6&quot;&gt;
&lt;br&gt;
&lt;h3&gt;
Doxygen &lt;span class=&quot;s6&quot;&gt;ドキュメント&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;p3&quot;&gt;
&lt;a href=&quot;http://www.glfw.org/docs/latest/index.html&quot;&gt;http://www.glfw.org/docs/latest/index.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/2405942570606144954/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2014/07/glfw3.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2405942570606144954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/2405942570606144954'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2014/07/glfw3.html' title='GLFW3の新機能'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-1948266447319193332</id><published>2014-07-05T10:43:00.003+09:00</published><updated>2014-07-12T17:46:41.308+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="glfw"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenGL"/><category scheme="http://www.blogger.com/atom/ns#" term="日本語訳"/><title type='text'>GLFW2から3への移行ガイド 日本語訳</title><content type='html'>&lt;h2&gt;
GLFW2から3への移行ガイド 日本語訳&lt;/h2&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.glfw.org/docs/latest/moving.html&quot; target=&quot;_blank&quot;&gt;Moving from GLFW 2 to 3&lt;/a&gt;&amp;nbsp;も翻訳しました．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;hr /&gt;
&lt;h3&gt;
目次&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;削除された機能
&lt;ul&gt;
&lt;li&gt;スレッド関数&lt;/li&gt;
&lt;li&gt;画像とテクスチャのロード&lt;/li&gt;
&lt;li&gt;文字アクション&lt;/li&gt;
&lt;li&gt;マウスホイール位置&lt;/li&gt;
&lt;li&gt;GLFWCALLマクロ&lt;/li&gt;
&lt;li&gt;Win32 MBCSのサポート&lt;/li&gt;
&lt;li&gt;XP以前のWindowsバージョンのサポート&lt;/li&gt;
&lt;li&gt;システム管理ホットキーのキャプチャ&lt;/li&gt;
&lt;li&gt;ウィンドウオープンのパラメータ&lt;/li&gt;
&lt;li&gt;イベントの自動ポーリング&lt;/li&gt;
&lt;li&gt;自動終了&lt;/li&gt;
&lt;li&gt;GLUヘッダの読込み&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;既存機能の変更&lt;ul&gt;
&lt;li&gt;ウィンドウハンドル&lt;/li&gt;
&lt;li&gt;マルチモニタのサポート&lt;/li&gt;
&lt;li&gt;ウィンドウの終了&lt;/li&gt;
&lt;li&gt;明示的なコンテキスト管理&lt;/li&gt;
&lt;li&gt;キーリビート&lt;/li&gt;
&lt;li&gt;物理キー入力&lt;/li&gt;
&lt;li&gt;ジョイスティック入力&lt;/li&gt;
&lt;li&gt;ビデオモードenum&lt;/li&gt;
&lt;li&gt;カーソル位置&lt;/li&gt;
&lt;li&gt;永続的なウィンドウヒント&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;名前の変更&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;ライブラリとヘッダファイル&lt;/li&gt;
&lt;li&gt;関数&lt;/li&gt;
&lt;li&gt;トークン&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;br /&gt;
これはGLFW2から3への移行ガイドです。
どんな変更や削除があったかを説明していますが、既存コードから新しいAPIへの移行時に必要な場合を除いて、新機能の説明しません。
例えば、GLFW3でフルスクリーンウィンドウを作成するために、新しいマルチモニタ関数の使用が必要です。&lt;br /&gt;
&lt;h2&gt;
削除された機能&lt;/h2&gt;
&lt;h3&gt;
スレッド関数&lt;/h3&gt;
スリープ関数を含め、スレッド関数は削除されました。
それらは、極めて原始的で、利用に際して統合化されておらず、GLFWの趣旨（すなわち、コンテキストや入力やウィンドウ）から外れ、時間を浪費します。
もっと良いスレッドライブラリがありますし、C++11やC11の両方にネイティブなスレッドサポートが利用可能で、それらは牽引を獲得しています。&lt;br /&gt;
もしC++11やC11の機能を使いたいけれどコンパイラがサポートしていない場合は、GLFWの原作者が作成しているTinyThread++やTinyCThreadプロジェクトを参照してください。
これらのライブラリは、C++11やC11のスレッドAPIの使いやすいサブセットを実装していて、実際にいくつかのGLFW3のテストプログラムではTinyCThreadを使っています。&lt;br /&gt;
とは言え、GLFW3は、GLFW2よりも良い、複数スレッドからの利用をサポートしています。
セカンダリスレッドから、コンテキストをカレントにしてレンダリングすることができ、ドキュメントには明示的に関数がセカンダリスレッドから利用できるか、メインスレッドつまりmainを呼び出すスレッドからの利用のみを想定しているかを記述しています。&lt;br /&gt;
&lt;h3&gt;
画像とテクスチャのロード&lt;/h3&gt;
画像とテクスチャのロード関数は削除されました。
Targa画像フォーマットのみがサポートされており、それらのほとんどが初級者レベルのサンプルに利用されています。
GLFW3でそれらを十分高い品質を保証するためには、他のフォーマットをサポートするだけでなく、OpenGLのテクスチャ機能への現代的な拡張も必要です。
それには、外部依存関係（libjpegやlibpngなど）を数多く追加したり、これらのライブラリのバージョンを固定してGLFWを出荷しなければなりません。&lt;br /&gt;
それを実現するためのライブラリが既にあり、この作業を重複することやGLFWへこの複製を紐付けることは不必要であると思います。
freeglutのようなGLFWに似たプロジェクトは、それらのライブラリから得ることもできます、そして、GLFWはOpenGLや標準入出力のようにどこでも利用可能であるためには、それらのライブラリのプラットフォーム依存の部分があってはいけません。&lt;br /&gt;
&lt;h3&gt;
文字アクション&lt;/h3&gt;
文字列コールバックのアクションパラメータは削除されました。これは、元々のGLFW、つまりスウェーデン人によって英国で開発していた時からありました。
けれど、多くのキーボードレイアウトでは、ダイアクリティカルマーク（発音記号）を入力するのに1つ以上のキーが必要です。
スウェーデン語キーボードでさえ、üのような稀なケースで同時押しが必要です。&lt;br /&gt;
文字列コールバックのアクション引数だけの削除であり、文字列コールバック自体の削除ではないことに注意してください。&lt;br /&gt;
&lt;h3&gt;
マウスホイール位置&lt;/h3&gt;
glfwGetMousWheel関数は削除されました。
スクロールイベントは絶対的な状態を表現しませんが、代わりに文字列入力のような相対的な状態変化を解釈します。
よって、文字列入力と同様に、返すための正常な“現在の状態”はありません。
マウスホイールコールバックは、スクロールコールバックに置き換えられ、2軸のスクロール量を受け取れます。&lt;br /&gt;
&lt;h3&gt;
GLFWCALLマクロ&lt;/h3&gt;
Windowsで__stdcallを使うコールバック関数を作成するGLFWCALLマクロは削除されました。
GLFWはCで書かれていて、Pascalではありません。
このマクロの削除は、GLFWユーザが覚えておくべき事項、つまり、すべてのコールバック関数をGLFWCALLでマークする必要があること、が1つ減ることを意味します。
DLLとDLLリンクライブラリの作成も単純化し、明示的に@nエントリポイント接尾語を無効にする必要がなくなります。&lt;br /&gt;
&lt;h3&gt;
Win32 MBCSのサポート&lt;/h3&gt;
GLFW3のWin32版は、MBCSモードでコンパインできなくなります。
しかし、Win32 APIのUnicode版を使えば処理全体にはまったく影響しませんし、それを用いてウィンドウ作成するだけで、同じアプリケーションの他の箇所からMBCS関数を呼び出すことも完璧にできます。
したがって、MBCSモードのコードを持つGLFWを用いたアプリショーションがあっても、GLFW自体がそれをサポートする必要はありません。&lt;br /&gt;
&lt;h3&gt;
XP以前のWindowsバージョンのサポート&lt;/h3&gt;
XP以前のWindowsバージョンの明示的なサポートは削除されました。
これらの以前のバージョンでGLFW3を動かすことを妨げるようなコードはありませんが、それらのバージョンにないWin32関数を使っています。&lt;br /&gt;
WindowsXPは2001年にリリースされ、現在（2013年）までにそれ以前のすべてのバージョンのWindowsを置き換えましたが、今は急速にWindows7や8に切り替えられつつあります。
MSDNライブラリはWindows2000以前のバージョンのドキュメントを既に提供していませんので、たとえ努力する価値があったとしても、これらのバージョンとの互換性を維持するのが困難になっています。&lt;br /&gt;
Win32 APIはまだ残っていますし、GLFW3はWindowsXP以降で利用可能な関数のみを使っています。
（Windows95をまだサポートしているGLFW2から見て新しい）XP以前のOSをサポートするとしても、最近のWindowsバージョンだけで用意されている多くの関数のためにランタイムチェックが必要となってしまいます。&lt;br /&gt;
&lt;h3&gt;
システム管理ホットキーのキャプチャ&lt;/h3&gt;
ALT+TABのようなシステム管理ホットキーを無効化して取得する機能は削除されました。
ゲームや科学的な可視化やそれ以外であっても、モダンなアプリケーションは行儀の良いデスクトップ市民であることが望まれていて、フルスクリーンモードで動作している時でさえ、これらのホットキーが機能することを期待されています。&lt;br /&gt;
&lt;h3&gt;
ウィンドウオープンのパラメータ&lt;/h3&gt;
GLFW_OPENEDウィンドウパラメータは削除されました。
ウィンドウオブジェクトが存在している限り、ウィンドウは“open”です。
ユーザがウィンドウを閉じようとしたことを検知するためには、glfwWindowShouldCloseと閉じるコールバックを参照してください。&lt;br /&gt;
&lt;h3&gt;
イベントの自動ポーリング&lt;/h3&gt;
GLFW3は、glfwSwapBuffers上でイベントの自動ポーリングを行いません。これはglfwPollEventsまたはglfwWaitEventを自分で呼び出す必要があることを意味します。
バッファスワップと異なり、イベント処理関数はすべてのウィンドウで1度だけ実行されます。&lt;br /&gt;
&lt;h3&gt;
自動終了&lt;/h3&gt;
GLFW3は、初期化時に、atexitにglfwTerminateを登録しません。
したがって、GLFWが確保したすべてのリソースを適切に解放するには、glfwTerminateを終了前に自分で呼び出さなければなりません。&lt;br /&gt;
&lt;h3&gt;
GLUヘッダの読込み&lt;/h3&gt;
GLFW3は、GLUヘッダをデフォルトでインクルードしなくなり、GLU自体が非推奨になっています。ですが、GLFW3ヘッダのインクルード前にGLFW_INCLUDE_GLUを定義しておくことで、GLFW3ヘッダがGLUをインクルードするようにできます。&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
既存機能の変更&lt;/h2&gt;
&lt;h3&gt;
Window handlesウィンドウハンドル&lt;/h3&gt;
GLFW3はマルチウィンドウをサポートしているので、ウィンドウハンドル引数がすべてのウィンドウ関連GLFW関数とコールバックに追加されました。
新しく作成したウィンドウのハンドルは、glfwCreateWindow（以前はglfwOpenWindow）によって返されます。
ウィンドウハンドルはGLFWWindow*型で、つまり、不透明な（訳注：opaque = 実装が隠蔽された）構造体へのポインタです。&lt;br /&gt;
&lt;h3&gt;
マルチモニタのサポート&lt;/h3&gt;
GLFW3はマルチモニタサポートを提供し、GLFWmonitor*ハンドル型と関連する関数群が追加されています。
フルスクリーンモードのウィンドウを要求するには、GLFW_FULLSCREENを渡す代わりに、そのウィンドウでどのモニタを使うかを指定します。
GLFW2と同様の振る舞いを提供するために、glfwGetPrimaryMonitorがあります。&lt;br /&gt;
&lt;h3&gt;
ウィンドウの終了&lt;/h3&gt;
ウィンドウの終了は、他と同様にユーザがイベントイベントを引き起こすことで始まります。
GLFW2と異なり、GLFW3で作成されたウィンドウとコンテキストは、足元から消えたりしません。
各ウィンドウは閉じるフラグを持つようになり、それはユーザがそのウィンドウを閉じようとした時にセットされます。
デフォルトでは、何もせず、ウィンドウは開いたままで見えた状態を維持します。
そこで、そのウィンドウを破棄する、他のアクションをする、あるいはその要求を単に無視するといった処理を自分で行います。
閉じるフラグの状態をglfwWindowShouldCloseで取得することや、いつでもglfwSetWindowShouldCloseを使ってフラグをセットすることが可能です。&lt;br /&gt;
閉じるコールバックは、値を返さなくなりました。
代わりに、閉じるフラグがセットされた直後に呼び出されます。そして、その値を上書きすることもできます。そうする場合は、イベント処理が完了する前にそれを行います。
しかしながら、閉じるコールバックの中で（あるいは、他のウィンドウ関連コールバックで）、glfwDestoryWindowを呼び出せないかも知れません。&lt;br /&gt;
GLFW自体は閉じるフラグをクリアすることはありませんが、実装者はウィンドウを閉じるためにいくつかの理由でそれをセットすることが許可されています。例えば、ユーザがメインメニューから終了を選択した場合などです。&lt;br /&gt;
&lt;h3&gt;
明示的なコンテキスト管理&lt;/h3&gt;
各GLFW3ウィンドウはOpenGLコンテキストを所有しており、実装者とユーザだけが、どんなときでもスレッド上でどのコンテキストがカレントになっているべきかを知っています。
したがって、GLFW3は、そのコンテキストがいつカレントになって、いつカレントじゃなくなるか、を仮定しません。それを決定するのはあなたです。&lt;br /&gt;
これは、他のことと合わせて、ウィンドウを作成した後で、OpenGL関数を呼出す前に、glfwMakeContextCurrentを呼出す必要があることを意味しています。&lt;br /&gt;
&lt;h3&gt;
キーリピート&lt;/h3&gt;
GLFW_KEY_REPEATの有効化は削除され、キーリピートはキーと文字列の両方で常に有効にになっています。
キーコールバックでリピートの中から最初のキー押下を区別するために、新しいキーアクションGLFW_REPEATが追加されました。
glfwGetKeyはGLFW_PRESSまたはGLFW_RELEASEのどちらかだけを返すままであることに注意してください。&lt;br /&gt;
&lt;h3&gt;
物理キー入力&lt;/h3&gt;
GLFW2では現在のキーボード配列によって生成された値になっていましたが、それと異なり、GLFW3のキートークンは物理キーにマッピングされています。
そのトークンは、標準US配列のキーボードを用いた値と対応する名前が付けられていますが、これは便利なだけでなく、ほとんどのプログラマがキー配列を知っていると仮定されています。&lt;br /&gt;
（例として） GLFW_KEY_LEFT_BRACKETは常に単一のキーであり、ユーザが使うキーボード配列がどんなものでも、同じ位置にある同じキーだということを意味しています。&lt;br /&gt;
キー入力機器は必ずしもテキストを入力することを意味しません、GLFW2ではとりあえず動いていたのでその方法を使っていましたけれど。
テキスト入力のためにそれを使っているなら、GLFW2でも3でも、文字列入力コールバックを使わなければなりません。
押下されたキーではなく、入力された文字列が取得できます。&lt;br /&gt;
GLFW3では、標準的な105キーのキーボードにおけるすべてのキーのトークンが用意されていますので、文字の ’a’や’A’をチェックする代わりに、GLFW_KEY_Aをチェックしてください。&lt;br /&gt;
&lt;h3&gt;
ジョイスティック入力&lt;/h3&gt;
glfwGetJoystickPos関数はglfwGetJoystickAxesへ名前が変更されました。&lt;br /&gt;
glfwGetJoystickParam関数とGLFW_PRESENT、GLFW_AXES、GLFW_BUTTONSトークンは、glfwJoystickPresent関数、軸とボタンカウントを返すglfwGetJoystickAxes関数とglfwGetJoystickButtons関数に置き換えられました。&lt;br /&gt;
&lt;h3&gt;
ビデオモードenum&lt;/h3&gt;
ビデオモードenumはモニタごとの値になっています。
glfwGetVideoModes関数は、必要な配列の大きさがどれくらいかを推定する必要はなく、指定したモニタのすべての利用可能なモードを返します。
貧弱な定義された挙動をしていたglfwGetDesktopMode関数は、glfwGetVideoMode関数に変更されています。
それは、現在のモニタのモードを返します。&lt;br /&gt;
&lt;h3&gt;
カーソル位置&lt;/h3&gt;
GLFW3は、ウィンドウがアクティブな場合だけglfwSetCursorPos (以前は glfwSetMousePos)を用いて、ウィンドウ上のカーソルの位置を設定することだけが可能です。
ウィンドウがアクティブになっていない場合は、この関数は暗黙的に失敗します。&lt;br /&gt;
&lt;h3&gt;
永続的なウィンドウヒント&lt;/h3&gt;
ウィンドウヒントはウィンドウ作成時のデフォルト値へリセットされなくなりましたが、代わりに、glfwWindowHint（以前はglfwOpenWindowHint）やglfwDefaultWindowHintsによって変更されるまで、あるいはライブラリが終了して再度初期化されるまで、それらの値が維持されます。&lt;br /&gt;
&lt;h2&gt;
名前の変更&lt;/h2&gt;
&lt;h3&gt;
ライブラリとヘッダファイル&lt;/h3&gt;
メジャーバージョンのヘッダとの衝突を避けるため、GLFW3ヘッダはglfw3。hという名前になってGLFWディレクトリへ移動されました。
同様に、GLFW3ライブラリはglfw3という名前になっています。ただし、Unix-likeなシステムの共有ライブラリとしてインストールされた場合を除きます。その場合はlibglfw。so。3というso名が利用されます。&lt;br /&gt;
&lt;h3&gt;
関数&lt;/h3&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;GLFW 2 &lt;/th&gt;&lt;th&gt;GLFW 3 &lt;/th&gt;&lt;th&gt;Notes &lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwOpenWindow&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwCreateWindow&lt;/td&gt;&lt;td&gt;すべてのチャンネルビット深度はヒントになりました&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwCloseWindow&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwDestroyWindow&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwOpenWindowHint&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwWindowHint&lt;/td&gt;&lt;td&gt;すべての&lt;code&gt;GLFW_*_BITS&lt;/code&gt;トークンを受け付けるようになりました&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwEnable&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwSetInputMode&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwDisable&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwSetInputMode&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwGetMousePos&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwGetCursorPos&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwSetMousePos&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwSetCursorPos&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwSetMousePosCallback&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwSetCursorPosCallback&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwSetMouseWheelCallback&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwSetScrollCallback&lt;/td&gt;&lt;td&gt;2軸のスクロールオフセットをdouble型で受け取ります&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwGetJoystickPos&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwGetJoystickAxes&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwGetWindowParam&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwGetWindowAttrib&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwGetGLVersion&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwGetWindowAttrib&lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_CONTEXT_VERSION_MAJOR&lt;/code&gt;， &lt;code&gt;GLFW_CONTEXT_VERSION_MINOR&lt;/code&gt;，&lt;code&gt;GLFW_CONTEXT_REVISION&amp;nbsp;&lt;/code&gt;を使います &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwGetDesktopMode&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwGetVideoMode&lt;/td&gt;&lt;td&gt;現在のモニタモードを返します&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;glfwGetJoystickParam&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwJoystickPresent&lt;/td&gt;&lt;td&gt;軸とボタン数は glfwGetJoystickAxes とglfwGetJoystickButtons によって提供される&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h3&gt;
トークン&lt;/h3&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th&gt;GLFW 2 &lt;/th&gt;&lt;th&gt;GLFW 3 &lt;/th&gt;&lt;th&gt;Notes &lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_OPENGL_VERSION_MAJOR&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_CONTEXT_VERSION_MAJOR&lt;/code&gt; &lt;/td&gt;&lt;td&gt;OpenGL ES にも適用するために名前を変更&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_OPENGL_VERSION_MINOR&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_CONTEXT_VERSION_MINOR&lt;/code&gt; &lt;/td&gt;&lt;td&gt;OpenGL ES にも適用するために名前を変更&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_FSAA_SAMPLES&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_SAMPLES&lt;/code&gt; &lt;/td&gt;&lt;td&gt;OpenGL API に沿って名前を変更&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_ACTIVE&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_FOCUSED&lt;/code&gt; &lt;/td&gt;&lt;td&gt;ウィンドウフォーカスコールバックに合わせて名前を変更&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_WINDOW_NO_RESIZE&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_RESIZABLE&lt;/code&gt; &lt;/td&gt;&lt;td&gt;デフォルトを逆にした&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_MOUSE_CURSOR&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_CURSOR&lt;/code&gt; &lt;/td&gt;&lt;td&gt;glfwSetInputModeで利用される&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_ESC&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_ESCAPE&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_DEL&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_DELETE&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_PAGEUP&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_PAGE_UP&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_PAGEDOWN&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_PAGE_DOWN&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_KP_NUM_LOCK&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_NUM_LOCK&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_LCTRL&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_LEFT_CONTROL&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_LSHIFT&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_LEFT_SHIFT&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_LALT&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_LEFT_ALT&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_LSUPER&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_LEFT_SUPER&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_RCTRL&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_RIGHT_CONTROL&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_RSHIFT&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_RIGHT_SHIFT&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_RALT&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_RIGHT_ALT&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GLFW_KEY_RSUPER&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;code&gt;GLFW_KEY_RIGHT_SUPER&lt;/code&gt; &lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Last update on Wed Nov 20 2013 for GLFW 3.0.4

&lt;iframe src=&quot;http://rcm-fe.amazon-adsystem.com/e/cm?lt1=_blank&amp;bc1=000000&amp;IS1=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=closed-22&amp;o=9&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=4894717239&quot; style=&quot;width:120px;height:240px;&quot; scrolling=&quot;no&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;

</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/1948266447319193332/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2014/07/glfw23.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1948266447319193332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/1948266447319193332'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2014/07/glfw23.html' title='GLFW2から3への移行ガイド 日本語訳'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-908965820509904680</id><published>2014-06-28T09:33:00.001+09:00</published><updated>2014-07-05T10:44:59.799+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dev"/><category scheme="http://www.blogger.com/atom/ns#" term="glfw"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenGL"/><title type='text'>GLFW3 Getting Started 日本語訳</title><content type='html'>&lt;div id=&quot;wrapper&quot;&gt;
&lt;div id=&quot;content&quot;&gt;
&lt;h2&gt;
GLFW3 Getting Started 日本語訳&lt;/h2&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.glfw.org/docs/latest/quick.html&quot; target=&quot;_blank&quot;&gt;GLFW: Getting Started&lt;/a&gt;の勝手な日本語翻訳です．GLFWを使い始める方は目を通しておくとよいでしょう．これを読めば，GLFWの大まかな使い方はわかるかと思います．&lt;/div&gt;
&lt;div&gt;
あ，オリジナル文書に用意されているリンクは機能してません＞＜&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;hr /&gt;
&lt;h3&gt;
目次&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;GLFWヘッダのインクルード&lt;/li&gt;
&lt;li&gt;GLFWの初期化と終了&lt;/li&gt;
&lt;li&gt;エラーコールバックの設定&lt;/li&gt;
&lt;li&gt;ウィンドウとコンテキストの作成&lt;/li&gt;
&lt;li&gt;OpenGLコンテキストをカレントにする&lt;/li&gt;
&lt;li&gt;ウィンドウの閉じるフラグのチェック&lt;/li&gt;
&lt;li&gt;入力イベントの受信&lt;/li&gt;
&lt;li&gt;OpenGLによるレンダリング&lt;/li&gt;
&lt;li&gt;タイマーの読み取り&lt;/li&gt;
&lt;li&gt;バッファのスワップ&lt;/li&gt;
&lt;li&gt;イベント処理&lt;/li&gt;
&lt;li&gt;書いてみよう: 小さなGLFWアプリケーション&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;br /&gt;
このガイドは、GLFW3を用いたシンプルなOpenGLアプリケーションを作る方法を解説します。
ここでは、最も頻繁に利用される幾つかの機能を紹介しますが、それら以外にも多くの機能が存在します。
GLFW関数の詳細なドキュメントを見る場合は、関数名をクリックしてください（訳注：リンクしてません:-(）．&lt;br /&gt;
このガイドは、以前のバージョンのGLFWを使った経験がない方を対象としています。
もしGLFW2を使ったことのある方は、&lt;a href=&quot;http://www.glfw.org/docs/latest/moving.html&quot; target=&quot;_blank&quot;&gt;移行ガイド&lt;/a&gt;（&lt;a href=&quot;http://csldevlog.blogspot.com/2014/07/glfw23.html&quot; target=&quot;_blank&quot;&gt;日本語訳&lt;/a&gt;）もご覧ください。&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;h3&gt;
GLFWヘッダのインクルード&lt;/h3&gt;
プログラムのOpenGLやGLFWを使うファイルでは、GLFW3ヘッダファイルをインクルードする必要があります。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;lt;GLFW/glfw3.h&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
これはGLFWのAPIの全ての定数、型、関数プロトタイプを定義します。
また、OpenGLヘッダもインクルードされ、プラットフォームで動作させるのに必要な全ての定数と型が定義されます。&lt;br /&gt;
例えば、Windowsでは通常GL/gl.hをインクルードする前に、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;windows.h&lt;/span&gt;をインクルードする必要があります。これは、ソースファイルがWindowsに紐付けられて、コードの名前空間がWin32APIに汚染されます。&lt;br /&gt;
その代わりに、GLFWヘッダがそれを行いますが、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;windows.h&lt;/span&gt;をインクルードするのではなく、その必要部分だけを複製することで処理します。
これは必要な場合にだけ実施されるので、もし&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;windows.h&lt;/span&gt;をインクルード済みであればGLFWヘッダはそれらのシンボルの再定義は行いません。&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
つまり:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;自分でOpenGLヘッダをインクルードしないこと。GLFWが行います。&lt;/li&gt;
&lt;li&gt;windows.hあるいはプラットフォーム固有のヘッダは、それらのAPIを直接利用するまでインクルードしないこと。&lt;/li&gt;
&lt;li&gt;それらのヘッダが必要になった場合は、GLFWヘッダをインクルードする前にインクルードすること。GLFWはこれを検出する。&lt;/li&gt;
&lt;/ul&gt;
バージョン3.0からは、GLUヘッダglu.hはデフォルトでインクルードされなくなりました。
もしインクルードしたい場合は、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;GLFW_INCLUDE_GLU&lt;/span&gt;をGLFWヘッダのインクルードの前に定義してください。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#define GLFW_INCLUDE_GLU
#include &amp;lt;GLFW/glfw3.h&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;
GLFWの初期化と終了&lt;/h3&gt;
GLFWの機能を使う前に、ライブラリを初期化しなければなりません。
これは、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwInit&lt;/span&gt;で実行され、成功したなら非ゼロ、エラーが発生した場合はゼロを返します。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;if (!glfwInit())
    exit(EXIT_FAILURE);
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
GLFWを使用しているときは、通常、プログラムの最後に&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwTerminate&lt;/span&gt;を呼び出す必要があります。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwTerminate();
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
これは、すべての残っているウィンドウを破棄して、すべての他のリソースを解放します。
これの呼出した後は、GLFW機能を利用する前に、再度&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwInit&lt;/span&gt;を呼び出す必要があります。&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
エラーコールバックの設定&lt;/h3&gt;
ほとんどのイベント(キーが押されたとか、GLFWウィンドウが移動したとか、エラーが発生しているとか)は、コールバックを介して報告されます。
コー​​ルバックは単なるCの関数（またはC++の静的メソッド）で、イベントに関する引数を持ってGLFWによって呼び出されます。&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwInit&lt;/span&gt;またはその他GLFW関数が失敗した場合、GLFWエラーコールバックにエラーがレポートされます。
エラーコールバックを設定することで、これらのレポートを受け取ることができます。
コー​​ルバック関数自体は&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;GLFWerrorfun&lt;/span&gt;のシグネチャと一致する必要があります。
ここに挙げるのは、単にstderrにエラーの説明を出力する単純なエラーコールバックです。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;void error_callback(int error, const char* description)
{
    fputs(description, stderr);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
コールバックを設定することで、GLFWはそれを呼び出せることを知らせるには、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwSetErrorCallback&lt;/span&gt;を使います。
これは、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwInit&lt;/span&gt;より前に呼び出すことのできるGLFW関数のひとつで、初期化中にエラーが発生を通知を受け取るために、他のGLFWを使う前に設定するべきです。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwSetErrorCallback(error_callback);&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;
ウィンドウとコンテキストの作成&lt;/h3&gt;
ウィンドウ (とそのコンテキスト)&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwCreateWindow&lt;/span&gt;で作成され、作成されたウィンドウハンドルを返します。
例えば、640x480のウィンドウモードのウィンドウを作成するには次のようにします:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;GLFWwindow* window = glfwCreateWindow(640, 480, &quot;My Title&quot;, NULL, NULL);
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
ウィンドウ作成に失敗した場合は、NULLが返されるので、それを確認する必要があります。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;if (!window)
{
    glfwTerminate();
    exit(EXIT_FAILURE);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
このハンドルは、すべてのウィンドウ関連関数に渡され、入力イベントと共に提供されるので、どのウィンドウがその入力を受け取ったかを知ることができます。&lt;br /&gt;
フルスクリーンウィンドウを作成するには、どのモニタにそのウィンドウを表示するかを指定する必要があります。
ほとんどの場合、ユーザのプライマリモニタを選ぶのが良いです。
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwGetPrimaryMonitor&lt;/span&gt;を使うとプライマリモニタを取得できます。
上述のウィンドウをフルスクリーンにするには、単にモニタハンドルを渡すだけです:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;GLFWwindow* window = glfwCreateWindow(640, 480, &quot;My Title&quot;, glfwGetPrimaryMonitor(), NULL);
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
フルスクリーンウィンドウは、モニタの表示エリア全体をカバーし、境界や装飾を持たず、そして、モニタの解像度を要求したウィンドウサイズに最も近いものに変更します。&lt;br /&gt;
そのウィンドウを使い終えた時は、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwDestroyWindow&lt;/span&gt;関数でウィンドウを破棄します。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwDestroyWindow(window);
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
この関数が一度呼び出されたら、そのウィンドウにはそれ以上イベントが届けられなくなり、そのハンドルは無効になります。&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
OpenGLコンテキストをカレントにする&lt;/h3&gt;
OpenGLのAPIを使う前に、OpenGLコンテキストを取得しなければなりません。
ウィンドウのコンテキストを&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwMakeContextCurrent&lt;/span&gt;を用いてカレントにします。
他のコンテキストをカレントにするまで、あるいはコンテキストを所有するウィンドウが破棄されるまで、カレントコンテキストのままになります。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwMakeContextCurrent(window);
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
ウィンドウ閉じるフラグのチェック&lt;/h3&gt;
各ウィンドウは、そのウィンドウが閉じられるべきであるかを示すフラグを持っています。
このフラグは、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwWindowShouldClose&lt;/span&gt;でチェックすることができます。&lt;br /&gt;
ユーザが、タイトルバーの閉じるボタンを押す、あるいはAlt+F4のようなショートカットで、ウィンドウを閉じようとした時、このフラグは1にセットされます。
その際、実際にはウィンドウはまだ閉じられていないことに注意してください。このフラグをモニタリングすることで、ウィンドウを破棄するか、ユーザに何らかのフィードバックを与えることができます。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;while (!glfwWindowShouldClose(window))
{
    // Keep running
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwSetWindowCloseCallback&lt;/span&gt;でクローズコールバックを設定することで、ユーザがウィンドウを閉じようとした時に通知を受け取ることができます。
そのコールバックはクローズフラグがセットされた直後に呼び出されます。&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwSetWindowShouldClose&lt;/span&gt;を用いて、自分自身でそれをセットすることも可能です。
これは他の入力をウィンドウを閉じるに変換したいとき、例えば、エスケープキーの押下で閉じるようにしたいときに便利です。&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
入力イベントの受信&lt;/h3&gt;
各ウィンドウは、すべての様々な種類のイベントを受け取るために設定できるコールバックを数多く持っています。
キー押下、押下解除イベントを受け取るには、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwSetKeyCallback&lt;/span&gt;でキーコールバックを設定します。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (key == GLFW_KEY_ESCAPE &amp;amp;&amp;amp; action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GL_TRUE);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
イベント発生時に実際に呼び出されるイベントコールバックに、上述したようなイベント処理が必要です。&lt;br /&gt;
&lt;h3&gt;
OpenGLによるレンダリング&lt;/h3&gt;
カレントOpenGLコンテキストを取得したあとは、OpenGLを普通に使えます。
このチュートリアルでは、多色の回転する三角形をレンダリングしてみます。
この例では&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glViewport&lt;/span&gt;や&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glOrtho&lt;/span&gt;で必要とされるフレームバッファのサイズは、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwGetFramebufferSize&lt;/span&gt;で受け取ることができます。&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;int width, height;
glfwGetFramebufferSize(window, &amp;amp;width, &amp;amp;height);
glViewport(0, 0, width, height);
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
しかし、コールバック&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwSetFramebufferSizeCallback&lt;/span&gt;を用いて、そこで&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glViewport&lt;/span&gt;を呼ぶことで、フレームバッファサイズを設定することも可能です。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
    glViewport(0, 0, width, height);
}&lt;b&gt;
&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;
タイマーの読み取り&lt;/h3&gt;
三角形を適切に回転させるには、時間の情報源が必要です。
GLFWは、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwInit&lt;/span&gt;からの経過秒数をdouble型で返す&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwGetTime&lt;/span&gt;を提供しています。
時間の情報源は各プラットフォームにおける最も精確なものが利用され、一般にはマイクロ秒あるいはナノ秒の分解能を持っています。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;double time = glfwGetTime();
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;
バッファのスワップ&lt;/h3&gt;
GLFWウィンドウは常にダブルバッファリングを使います。
2つのレンダリングバッファを持つことを意味しています; フロントバッファとバックバッファ。
フロントバッファは画面に表示されているもので、バックバッファはレンダリングの対象のものです。&lt;br /&gt;
フレーム全体のレンダリングが完了した時、レンダリングしたフレームを表示し、そして、新しいフレームのレンダリングを開始するために、バックとフロントを入れ替えます。
これは&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwSwapBuffers&lt;/span&gt;で行えます。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwSwapBuffers(window);
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;h3&gt;
イベント処理&lt;/h3&gt;
GLFWは、イベントの受け取りのため、および、ロックされていないことを示すための両方の目的のために、ウィンドウシステムと定期的に通信する必要があります。
イベント処理は定期的に行う必要があり、通常、各フレームのレンダリングの前にとバッファスワップの後に行われます。&lt;br /&gt;
保留中のイベントを処理する方法は2つあります。
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwPollEvents&lt;/span&gt;はそれらの受信済みイベントだけを処理して、すぐにリターンします。
これは、ほとんどのゲームが行うように継続的にレンダリングする場合に最良のチョイスです。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwPollEvents();
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
新しい入力を受け取ったときにだけレンダリングの更新が必要な場合は、代わりに、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwWaitEvents&lt;/span&gt;を使うのがベターです。
それは、少なくとも1つのイベントが受信されるまで待ち、その間はスレッドをスリープしておき、それから、&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;glfwPollEvents&lt;/span&gt;が行うようにすべての受信イベントを処理します。
この方法は、CPUサイクルをかなり抑えることができ、例えば、いろんなエディットツールにおいて有用です。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;glfwWaitEvents();
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;br /&gt;
&lt;h3&gt;
書いてみよう: 小さなGLFWアプリケーション&lt;/h3&gt;
いま、GLFWを初期化し、ウィンドウを作成し、キーボード入力を取得する方法がわかったので、シンプルなプログラムを作成できるようになりました。&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;lt;GLFW/glfw3.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
static void error_callback(int error, const char* description)
{
    fputs(description, stderr);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (key == GLFW_KEY_ESCAPE &amp;amp;&amp;amp; action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GL_TRUE);
}
int main(void)
{
    GLFWwindow* window;
    glfwSetErrorCallback(error_callback);
    if (!glfwInit())
        exit(EXIT_FAILURE);
    window = glfwCreateWindow(640, 480, &quot;Simple example&quot;, NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
    while (!glfwWindowShouldClose(window))
    {
        float ratio;
        int width, height;
        glfwGetFramebufferSize(window, &amp;amp;width, &amp;amp;height);
        ratio = width / (float) height;
        glViewport(0, 0, width, height);
        glClear(GL_COLOR_BUFFER_BIT);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
        glBegin(GL_TRIANGLES);
        glColor3f(1.f, 0.f, 0.f);
        glVertex3f(-0.6f, -0.4f, 0.f);
        glColor3f(0.f, 1.f, 0.f);
        glVertex3f(0.6f, -0.4f, 0.f);
        glColor3f(0.f, 0.f, 1.f);
        glVertex3f(0.f, 0.6f, 0.f);
        glEnd();
        glfwSwapBuffers(window);
        glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
    exit(EXIT_SUCCESS);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
このプログラムは、640x480のウィンドウモードの画面を作成してから、スクリーンの消去、三角形のレンダリング、イベント処理のループを、ウィンドウがユーザに閉じるまで行います。
これはソースコード配布の&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;examples/simple.c&lt;/span&gt;にあり、GLFWをビルドする時に、デフォルトで他のサンプルと一緒にコンパイルされます。&lt;br /&gt;
コンパイル
GLFWを使うプログラムをコンパイル・リンクする方法について知りたい場合は、&lt;a href=&quot;http://www.glfw.org/docs/latest/build.html&quot; target=&quot;_blank&quot;&gt;Building programs that use GLFW&lt;/a&gt;を参照してください。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;!-- End wrapper --&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/908965820509904680/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2014/06/glfw3-getting-started.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/908965820509904680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/908965820509904680'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2014/06/glfw3-getting-started.html' title='GLFW3 Getting Started 日本語訳'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8997670151541573613.post-7462024858333149972</id><published>2014-05-17T23:48:00.001+09:00</published><updated>2014-07-12T18:00:58.152+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="glfw"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenGL"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="vc2013"/><title type='text'>glfw3の使い方(VS2013)</title><content type='html'>&lt;h2&gt;
目的&lt;/h2&gt;
&lt;div&gt;
glutがいけてないので，glfwを使ったOpenGLウィンドウの作り方をメモする．&lt;br /&gt;
久しぶりのウィンドウズ環境なので，いろいろ戸惑ったりすると思うので，備忘録として．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
glfw3を静的ライブラリとして使う．&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
開発環境&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Visual C++2013 Express Edition&lt;/li&gt;
&lt;li&gt;Windows 8.1 (64bit)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;h2&gt;
準備&lt;/h2&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;glfw3をダウンロード，配置&lt;/li&gt;
&lt;li&gt;VCプロジェクトの作成&lt;/li&gt;
&lt;li&gt;プロジェクトの設定&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;br /&gt;
&lt;h3&gt;
glfw3をダウンロード，配置&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.glfw.org/download.html&quot; target=&quot;_blank&quot;&gt;GLFWのダウンロードページ&lt;/a&gt;&amp;nbsp;へ行って「Windows pre-compiled binaries」からダウンロードします．&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; http://www.glfw.org/download.html&lt;/div&gt;
&lt;div&gt;
2つのパッケージがあるので，32bitか64bitの適切な方を選びましょう．&lt;/div&gt;
&lt;div&gt;
あとで作るVC++のプロジェクト設定にも関係するので，あとで決める，どっちも使うかも，という場合は，両方ダウンロードしちゃいましょう．&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhURPJiRGkQOehEcIY3UCI5dExFXiEBGjwEPjWkZ9xES-nM7glUg0iL3-CQ-UYHqVn7IywpAwSYnMq0BbBswOeTrWsXGIYNFyhZPY6YqIIYeNu2UNloS7fhDqFY8p_5oFsTIOVCi7Nue5VO/s1600/Screenshot_051714_084711_PM.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhURPJiRGkQOehEcIY3UCI5dExFXiEBGjwEPjWkZ9xES-nM7glUg0iL3-CQ-UYHqVn7IywpAwSYnMq0BbBswOeTrWsXGIYNFyhZPY6YqIIYeNu2UNloS7fhDqFY8p_5oFsTIOVCi7Nue5VO/s1600/Screenshot_051714_084711_PM.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ダウンロードした「glfw-3.0.4.bin.WIN32.zip」か「glfw-3.0.4.bin.WIN64.zip」を解凍します．&lt;/div&gt;
&lt;div&gt;
解凍したファイルの中を次のようなライブラリ用のフォルダに配置します．以下の例は，私の場合の配置場所になっていますので，分かっている人はイイ感じのところにおいてください．&lt;/div&gt;
&lt;div&gt;
（※ VSから参照できる場所(C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\gl とか)に置いてもいいんですが，私の個人的なルールに従い別の場所に置きます）&lt;br /&gt;
&lt;br /&gt;
こういう構成のフォルダを作ってあります：&lt;br /&gt;
c:\&lt;br /&gt;
&amp;nbsp; └ usr\&lt;br /&gt;
　　└ local\&lt;br /&gt;
　　　　└include\&lt;br /&gt;
　　　　└lib32\&lt;br /&gt;
　　　　└lib64\&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
解凍ファイル内のincludeフォルダ内のGLFWフォルダを，上記includeにコピー．&lt;br /&gt;
lib-msvc120内のファイルをlib32またはlib64へコピーします．&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
osxならhomebrewで勝手に入ってくれて楽ちんなんですけどね...&lt;/div&gt;
&lt;div&gt;
nuGetでも入れられるようですが．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
VCプロジェクトの作成&lt;/h3&gt;
&lt;div&gt;
「ファイル」-「新しいプロジェクト」から，「Win32 コンソール アプリケーション」を作成．&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
プロジェクトの設定&lt;/h3&gt;
メニュー「プロジェクト」-「～～のプロパティ」&lt;br /&gt;
構成プロパティの「VC++ディレクトリ」に，includeディレクトリとlibディレクトリへのパスを追加する．&lt;br /&gt;
ここで，$(PlatformArchitecture)を用いて，lib32とlib64が自動的に切り替わるようにしておくと32bitと64bitを気軽にスイッチできる．&lt;br /&gt;
&lt;br /&gt;
インクルード ディレクトリ： C:\usr\local\include&lt;br /&gt;
ライブラリ ディレクトリ： C:\usr\local\lib$(PlatformArchitecture)&lt;br /&gt;
「親を継承」的なチェックボックスはON．&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrzH8wxfA2tD6b6Kl9Fbu7BqvpJphALRj7yAXfF-JWFqh7tXg7E3e3eF1G_LN4HWrSechyvIZoE9Xs-v2dCoeysdF6SY4-nRQt9fHRoiDkj3cVs9mgElIeaH9fGTTBLv2oewOmrVtiHw3s/s1600/Screenshot_051714_113245_PM.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrzH8wxfA2tD6b6Kl9Fbu7BqvpJphALRj7yAXfF-JWFqh7tXg7E3e3eF1G_LN4HWrSechyvIZoE9Xs-v2dCoeysdF6SY4-nRQt9fHRoiDkj3cVs9mgElIeaH9fGTTBLv2oewOmrVtiHw3s/s1600/Screenshot_051714_113245_PM.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
さらに，続けてライブラリも設定する．&lt;br /&gt;
「リンカー」「入力」の「追加の依存ファイル」にライブラリファイルを追加．&lt;br /&gt;
opengl32.lib;glfw3.lib&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4oly294WSI8Z25xMKJnHeCDfolKLlflBC6DOhUDLS1FGGia5mWPXC1M7TWnC9f1cnXfZTf4TPoRrIBbiZoXxr3PoFy8z6E0GsxoUfqibv6DDTA4zIZIe0FO3rIFw5DYgez140p0PwSxFK/s1600/Screenshot_051714_113726_PM.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4oly294WSI8Z25xMKJnHeCDfolKLlflBC6DOhUDLS1FGGia5mWPXC1M7TWnC9f1cnXfZTf4TPoRrIBbiZoXxr3PoFy8z6E0GsxoUfqibv6DDTA4zIZIe0FO3rIFw5DYgez140p0PwSxFK/s1600/Screenshot_051714_113726_PM.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
サンプルを動かす&lt;/h2&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#include &amp;lt;GLFW/glfw3.h&amp;gt;&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; GLFWwindow* window;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /* Initialize the library */&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if (!glfwInit())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return -1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /* Create a windowed mode window and its OpenGL context */&lt;br /&gt;
&amp;nbsp; &amp;nbsp; window = glfwCreateWindow(640, 480, &quot;Hello World&quot;, NULL, NULL);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if (!window)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; glfwTerminate();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return -1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /* Make the window&#39;s context current */&lt;br /&gt;
&amp;nbsp; &amp;nbsp; glfwMakeContextCurrent(window);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /* Loop until the user closes the window */&lt;br /&gt;
&amp;nbsp; &amp;nbsp; while (!glfwWindowShouldClose(window))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Render here */&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Swap front and back buffers */&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; glfwSwapBuffers(window);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* Poll for and process events */&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; glfwPollEvents();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; glfwTerminate();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; return 0;&lt;br /&gt;
}&lt;/blockquote&gt;
&lt;/div&gt;
（http://www.glfw.org/documentation.html のExample Codeから）&lt;br /&gt;
&lt;br /&gt;
あとはビルドしてウィンドウが表示されることを確認しておしまい．&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
参考&lt;/h2&gt;
&lt;div&gt;
&lt;a href=&quot;http://www.glfw.org/docs/latest/quick.html&quot; target=&quot;_blank&quot;&gt;GLFW: Getting started &lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20120906&quot; target=&quot;_blank&quot;&gt;床井研究室 2012年09月06日 [OpenGL][GLFW] (1) GLFW で OpenGL を使う&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;

&lt;iframe src=&quot;http://rcm-fe.amazon-adsystem.com/e/cm?lt1=_blank&amp;bc1=000000&amp;IS1=1&amp;nou=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=closed-22&amp;o=9&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=B00K0Z2VV6&quot; style=&quot;width:120px;height:240px;&quot; scrolling=&quot;no&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;

</content><link rel='replies' type='application/atom+xml' href='http://csldevlog.blogspot.com/feeds/7462024858333149972/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://csldevlog.blogspot.com/2014/05/glfw3vs2013.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/7462024858333149972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8997670151541573613/posts/default/7462024858333149972'/><link rel='alternate' type='text/html' href='http://csldevlog.blogspot.com/2014/05/glfw3vs2013.html' title='glfw3の使い方(VS2013)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhURPJiRGkQOehEcIY3UCI5dExFXiEBGjwEPjWkZ9xES-nM7glUg0iL3-CQ-UYHqVn7IywpAwSYnMq0BbBswOeTrWsXGIYNFyhZPY6YqIIYeNu2UNloS7fhDqFY8p_5oFsTIOVCi7Nue5VO/s72-c/Screenshot_051714_084711_PM.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>