この文書の現在のバージョンと選択したバージョンの差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 最新リビジョン 両方とも次のリビジョン | ||
c.sharp:opentk [2018/04/22 13:35] fifi |
c.sharp:opentk [2018/05/03 13:19] fifi |
||
---|---|---|---|
ライン 1: | ライン 1: | ||
+ | # リファレンス | ||
+ | - [OpenGL入門](http://wisdom.sakura.ne.jp/system/opengl/) | ||
+ | - [Xamarin OpenGLES](https://developer.xamarin.com/api/namespace/OpenTK/) | ||
+ | - [giawa/opengl4tutorials: Tutorial Particle](https://github.com/giawa/opengl4tutorials) | ||
+ | - [neokabuto/OpenTKTutorialContent: Project files from OpenTK tutorials from my blog](https://github.com/neokabuto/OpenTKTutorialContent) | ||
+ | - [jeske/SimpleScene: Simple 3D scene manager in C# and OpenTK / OpenGL](https://github.com/jeske/SimpleScene) | ||
+ | |||
+ | # 座標変換を完全に理解する | ||
+ | |||
+ | - ワールド座標変換 | ||
+ | - ビュー/プロジェクション座標変換 | ||
+ | -- 2Dに変換する工程 | ||
+ | -- クリッピング座標系(正規化視野空間とか正規化デバイス座標系) | ||
+ | -- 透視投影変換 | ||
+ | -- 平行投影変換 | ||
+ | |||
+ | - 射影変換 | ||
+ | |||
+ | # 3Dの座標グリッドを美しく表示する方法 | ||
+ | |||
+ | - [Drawing a Grid in OpenTK](http://deathbyalgorithm.blogspot.jp/2013/05/drawing-grid-in-opentk.html) | ||
+ | - [Setting up OpenTK](http://deathbyalgorithm.blogspot.jp/2013/05/setting-up-opentk.html) | ||
+ | |||
+ | ```c | ||
+ | /* 線のアンチエイリアス */ | ||
+ | GL.Enable(EnableCap.LineSmooth); // 線のアンチエイリアスを有効化 | ||
+ | GL.Hint(HintTarget.LineQualityHintSgix, HintMode.Fastest); // アンチエイリアスの | ||
+ | GL.Enable(EnableCap.Blend); // 線周辺のブレンドを | ||
+ | GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); | ||
+ | ``` | ||
# OpenTKの文字列表示について | # OpenTKの文字列表示について | ||
+ | |||
+ | OpenTK.Graphics.TextPrinterを使う場合には、メモリリークに注意 | ||
+ | |||
+ | TextPrinterOptions.Defaultの場合はcacheがたまってしまう。.TextPrinterOptions.NoCacheにすべき。 | ||
+ | |||
+ | [opentkのライブラリ](https://github.com/mono/opentk/blob/master/Source/Compatibility/Graphics/TextPrinter.cs) | ||
+ | には入っているが、 | ||
+ | |||
+ | [2016年の情報](https://www.codeproject.com/Articles/1057539/Abstract-of-the-text-rendering-with-OpenGL-OpenTK)では | ||
+ | 外部ライブラリを使うとある。情報は古いかもしれないが(2018/4/22時点では以下のコードで動いた) | ||
+ | |||
```c | ```c | ||
ライン 44: | ライン 85: | ||
GL.Viewport(0, 0, Width, Height); | GL.Viewport(0, 0, Width, Height); | ||
- | GL.Ortho(0, Width, Height, 0, -1, 1); | + | GL.Ortho(0, Width, Height, 0, -1, 1); // 射影変換 その他Perspectiveもある |
// ******** Text Rendering | // ******** Text Rendering | ||
- | text.Print("FrontTextView", printerFont1, Color.Black); | + | text.Begin(); |
- | + | text.Print(this.BaseText, printerFont1, Color.DimGray, drawRect, OpenTK.Graphics.TextPrinterOptions.NoCache); | |
- | text.Print("nohara tomoyuki", printerFont1, Color.Blue, new RectangleF(Width / 2, 0, Width, 0)); | + | text.End(); |
- | text.Print("hellow OpenTK Text", printerFont1, Color.Black, new RectangleF(Width / 2, Height / 4, Width, 0)); | + | |
- | text.Print(poem, printerFont2, Color.Black, new RectangleF(Width / 2, Height / 2, Width / 3, 0)); | + | |
// ******** This is equivalent: | // ******** This is equivalent: | ||
GL.MatrixMode(MatrixMode.Modelview); | GL.MatrixMode(MatrixMode.Modelview); |