protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); base.InitializeContexts(); graphics = new GLGraphics(this, Color.White); graphics.InitScene(worldTransform, Color.White); }
public new void Draw() { // check if we've constructed the graphics class yet if (graphics == null) { return; } Form parentForm = this.FindForm(); if (parentForm != null && (parentForm.WindowState == FormWindowState.Minimized || !parentForm.Visible)) { return; } // fill in the screen size SizeF clientSize = this.ClientSize; if (clientSize != worldTransform.ScreenSize) { worldTransform.ScreenSize = clientSize; } // call the setup transform on the current control if (currentTool != null) { currentTool.SetupTransform(worldTransform); } // initialize the GL utility graphics.InitScene(worldTransform, Color.White); // call pre-paint if (currentTool != null) { currentTool.OnPreRender(graphics, worldTransform); } // render each of the display objects foreach (IRenderable obj in Services.DisplayObjectService.GetVisibleEnumerator()) { if (!object.Equals(obj, selectedObject)) { obj.Render(graphics, worldTransform); } } // render the selected object last if (selectedObject != null) { selectedObject.Render(graphics, worldTransform); } // call post-paint if (currentTool != null) { currentTool.OnPostRender(graphics, worldTransform); } // invoke the drawing on the base gl control base.Draw(); }