private void DoSetup() { ////_MView.InitializeShading(); //var windowHandle = (IntPtr) _MView.GetViewHWndx64(); _MView.UpdateAllGraphicsLayers = true; _MView.InitializeShading(); //Toolkit.Init(); //var windowInfo = Utilities.CreateWindowsWindowInfo(windowHandle); ////var context = new GraphicsContext(GraphicsMode.Default, windowInfo); //var contextHandle = new ContextHandle(windowHandle); //var context = new GraphicsContext(contextHandle, Wgl.GetProcAddress, () => contextHandle); //context.MakeCurrent(windowInfo); //context.LoadAll(); // TODO some resources are not disposed here. // Really we should call `var tk = Toolkit.Init();` here (that's what `GLControl.ctor` does) // and then dispose `tk`. using (var ctrl = new GLControl()) using (ctrl.CreateGraphics()) { } //Toolkit.Init(); //IGraphicsContext context = new GraphicsContext( // new ContextHandle(windowHandle),null ); //context.LoadAll(); }
public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); Logger.SetLogControl(richTextBox1); glWin = new GLControl(); splitContainer2.Panel2.Controls.Add(glWin); OpenTK.Toolkit.Init(); glWin.CreateControl(); glWin.CreateGraphics(); glWin.Dock = DockStyle.Fill; glWin.BackColor = Color.DarkGray; glWin.BringToFront(); // // TODO: Add constructor code after the InitializeComponent() call. // Scene.Init(glWin); glWin.KeyDown += glWin_KeyPress; glWin.KeyUp += glWin_KeyRelease; glWin.MouseMove += glWin_MouseMove; glWin.MouseWheel += glWin_MouseWheel; glWin.Paint += glWin_Paint; RenderTimer.Interval = 15; RenderTimer.Tick += Repaint; RenderTimer.Start(); }