/// <summary> /// The method called when the GLControl loads /// </summary> /// <param name="sender">Object sending the event</param> /// <param name="e">Event arguments</param> private void GLControl1_Load(object sender, EventArgs e) { cam = new InventorCamera(); glControl1.KeyDown += Viewer_KeyDown; glControl1.KeyUp += Viewer_KeyUp; glControl1.MouseDown += Viewer_MouseDown; glControl1.MouseUp += Viewer_MouseUp; glControl1.MouseMove += Viewer_MouseMoved; glControl1.MouseWheel += Viewer_MouseWheel; GL.ClearColor(System.Drawing.Color.LightGreen); GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Light0); GL.Enable(EnableCap.Light1); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.CullFace); GL.CullFace(CullFaceMode.Back); int j = ShaderLoader.PartShader;//Loadshader SetupSelectBuffer(); Application.Idle += delegate(object send, EventArgs ea) { while (glControl1.IsIdle) { GLControl1_Paint(null, null); } }; IsLoaded = true; }
public Form1() { InitializeComponent(); oCamera = new InventorCamera(); controller = new Controller(); InitializeTexBox(); AddToLog("Component initialization."); Thread.Sleep(100); // wait for connection if (controller.Devices.IsEmpty) { AddToLog("ERROR: No connection to Leap Motion service."); AddToLog("ERROR: Connect device and restart application."); return; } else { AddToLog("Connected to Leap Motion service."); controller.EnableGesture(Gesture.GestureType.TYPE_SWIPE); controller.EnableGesture(Gesture.GestureType.TYPE_CIRCLE); listener = new LeapEventListener(this); controller.SetPolicyFlags(Controller.PolicyFlag.POLICY_BACKGROUND_FRAMES); controller.AddListener(listener); } if (!oCamera.IsStarted()) AddToLog("ERROR: Inventor instance not found."); else AddToLog("Iventor instance found. "); if (!oCamera.IsOpened()) AddToLog("ERROR: Assembly, part or presentation document not found."); else AddToLog(oCamera.GetDocType() + " document found."); }