private void RenderControl(RenderEventArgs e, Control ctl) { if (ctl is Control2D) { Control2D c2d = (ctl as Control2D); Internal.OpenGL.Methods.glMatrixMode(MatrixMode.ModelView); Internal.OpenGL.Methods.glTranslated(c2d.Position.X, c2d.Position.Y, 0); Internal.OpenGL.Methods.glTranslated(5, 1, 0); } BeforeRenderEventArgs bre = new BeforeRenderEventArgs(e.Canvas); ctl.OnBeforeRender(bre); if (bre.Cancel) return; ctl.OnRender(e); ctl.OnAfterRender(e); if (ctl is Control2D) { Control2D c2d = (ctl as Control2D); Internal.OpenGL.Methods.glMatrixMode(MatrixMode.ModelView); Internal.OpenGL.Methods.glTranslated(-c2d.Position.X, -c2d.Position.Y, 0); Internal.OpenGL.Methods.glTranslated(-5, -1, 0); } }