以下のページが非常に参考になっているが、コードを実行時に警告が出て、戸惑ったので、備忘録を残す。
http://masuqat.net/programming/csharp/OpenTKindex.php
OpenTKで以下のような警告がいっぱい出た。
「警告 CS0618 'GameWindow.Mouse' は旧形式です ('Use MouseMove, MouseDown, MouseUp and MouseWheel events or OpenTK.Input.Mouse, instead.') 」
とか
「警告 CS0618 'Matrix4.Rotate(Quaternion)' は旧形式です ('Use CreateRotation instead.')」
とか
「警告 CS0618 'GL.DrawArrays(BeginMode, int, int)' は旧形式です ('Use PrimitiveType overload instead')」
え、旧形式を勉強してるの。。。と少し萎えたが、簡単に新形式に置き換えできた。
備忘録として残しておく。
this.Mouse.ButtonDown
↓
this.MouseDown
this.Mouse.ButtonUp
↓
this.MouseUp
this.Mouse.Move
↓
this.MouseMove
↓
this.MouseMove
this.Mouse.WheelChanged
↓
this.MouseWheel
Matrix4.Rotate
↓
Matrix4.CreateFromQuaternion
if (Keyboard[Key.Escape])
{
this.Exit();
}
↓
KeyDown += (sender, eKey) =>
{
if (eKey.Keyboard[Key.Escape])
{
this.Exit();
}
}
↓
this.MouseWheel
Matrix4.Rotate
↓
Matrix4.CreateFromQuaternion
if (Keyboard[Key.Escape])
{
this.Exit();
}
↓
KeyDown += (sender, eKey) =>
{
if (eKey.Keyboard[Key.Escape])
{
this.Exit();
}
}
GL.DrawArrays(BeginMode.Lines, 0, 2); // 単位表示
↓
GL.DrawArrays(PrimitiveType.Lines, 0, 2); // 単位表示
分かれば、たいしたことではないが、初心者には中々心理的ハードルが高かった 笑。
基本的にはエラー文を参考にすれば、丁寧に解説してくれているので、簡単に直すことが可能。一瞬大掛かりな形式に変わったのかと身構えてしまうがそんなことは無いので、安心しよう。
壁にめげずに学ぶぞ 笑
参考ページ
http://stackoverflow.com/questions/32503171/how-to-use-gl-drawarrays-to-draw-linestrip-using-opentk