Example #1
0
        public void FBOInitializeView(bool perspectiveProjection, float z)
        {
            double height = Math.Max(this.Height, 1);
            double width  = Math.Max(this.Width, 1);

            GL.Viewport(0, 0, (int)width, (int)height);
            double aspectRatio = width / height;

            GL.MatrixMode(MatrixMode.Projection);                   // Select The Projection Matrix
            GL.LoadIdentity();                                      // Reset The Projection Matrix

            var ratio = this.Width / (double)this.Height;

            if (perspectiveProjection)
            {
                Glu.Perspective(45, ratio, .01, 1000.0);
            }
            else
            {
                double size = z * -.4;
                GL.Ortho(-ratio * size, ratio * size, -size, size, -100, 100);
            }
            GL.MatrixMode(MatrixMode.Modelview);                    // Select The Modelview Matrix
            GL.LoadIdentity();                                      // Reset The Modelview Matrix
        }