示例#1
0
        /// <summary>
        /// Called when your window is resized. Set your viewport here. It is also
        /// a good place to set up your projection matrix (which probably changes
        /// along when the aspect ratio of your window).
        /// </summary>
        /// <param name="e">Contains information on the new Width and Size of the GameWindow.</param>
        protected override void OnResize(ResizeEventArgs e)
        {
            if (e.Height > 0 && e.Width > 0)
            {
                GL.Viewport(0, 0, Width, Height);
                GL.MatrixMode(MatrixMode.Projection);
                GL.LoadIdentity();
                Glu.Ortho2D(Constants.SIM_DOMAIN.Left, Constants.SIM_DOMAIN.Right, Constants.SIM_DOMAIN.Top, Constants.SIM_DOMAIN.Bottom);
            }

            base.OnResize(e);
        }
示例#2
0
 public override void SetOrthoProjection(Rectangle region)
 {
     GL.MatrixMode(MatrixMode.Projection);
     GL.LoadIdentity();
     Glu.Ortho2D(region.Left, region.Right, region.Bottom, region.Top);
 }