|
@@ -1,88 +0,0 @@
|
|
|
-using System;
|
|
|
-using System.Collections.Generic;
|
|
|
-using System.Linq;
|
|
|
-using System.Text;
|
|
|
-using System.Drawing;
|
|
|
-using OpenTK;
|
|
|
-using OpenTK.Graphics.OpenGL;
|
|
|
-using Iisu;
|
|
|
-
|
|
|
-namespace bbiwarg
|
|
|
-{
|
|
|
- class Program : GameWindow
|
|
|
- {
|
|
|
-
|
|
|
- static void Main(string[] args)
|
|
|
- {
|
|
|
- Program demo = new Program();
|
|
|
- demo.init();
|
|
|
- demo.Run(30);
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnLoad(EventArgs e)
|
|
|
- {
|
|
|
- base.OnLoad(e);
|
|
|
- Title = "Hello OpenTK!";
|
|
|
- GL.ClearColor(Color.CornflowerBlue);
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnRenderFrame(FrameEventArgs e)
|
|
|
- {
|
|
|
- base.OnRenderFrame(e);
|
|
|
-
|
|
|
- device.UpdateFrame(true);
|
|
|
-
|
|
|
-
|
|
|
- GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
|
|
-
|
|
|
- Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY);
|
|
|
- GL.MatrixMode(MatrixMode.Modelview);
|
|
|
- GL.LoadMatrix(ref modelview);
|
|
|
-
|
|
|
- // triangle
|
|
|
- GL.Begin(BeginMode.Triangles);
|
|
|
-
|
|
|
- float x = palmPosition.Value._X;
|
|
|
- float y = palmPosition.Value._Y;
|
|
|
- float z = palmPosition.Value._Z;
|
|
|
-
|
|
|
- GL.Vertex3(-1.0f + x, -1.0f + z, 4.0f - 10*y);
|
|
|
- GL.Vertex3(1.0f, -1.0f, 4.0f);
|
|
|
- GL.Vertex3(0.0f, 1.0f, 4.0f);
|
|
|
- GL.End();
|
|
|
-
|
|
|
- SwapBuffers();
|
|
|
- device.ReleaseFrame();
|
|
|
- }
|
|
|
-
|
|
|
- protected override void OnResize(EventArgs e)
|
|
|
- {
|
|
|
-
|
|
|
- base.OnResize(e);
|
|
|
-
|
|
|
- GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
|
|
|
-
|
|
|
- Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView((float)Math.PI / 4, Width / (float)Height, 1.0f, 64.0f);
|
|
|
-
|
|
|
- GL.MatrixMode(MatrixMode.Projection);
|
|
|
-
|
|
|
- GL.LoadMatrix(ref projection);
|
|
|
- }
|
|
|
-
|
|
|
- private IHandle handle;
|
|
|
- private IDevice device;
|
|
|
- private IDataHandle<Iisu.Data.Vector3> palmPosition;
|
|
|
-
|
|
|
- public void init()
|
|
|
- {
|
|
|
- handle = Iisu.Iisu.Context.CreateHandle();
|
|
|
- device = handle.InitializeDevice();
|
|
|
- IEventManager em = handle.EventManager;
|
|
|
-
|
|
|
- palmPosition = device.RegisterDataHandle<Iisu.Data.Vector3>("CI.HAND1.PalmPosition3D");
|
|
|
-
|
|
|
- device.Start();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-}
|