Example #1
0
        public virtual void R_SetupGL( )
        {
            var x  = r_newrefdef.x;
            var x2 = r_newrefdef.x + r_newrefdef.width;
            var y  = vid.GetHeight() - r_newrefdef.y;
            var y2 = vid.GetHeight() - (r_newrefdef.y + r_newrefdef.height);
            var w  = x2 - x;
            var h  = y - y2;

            GL.Viewport(x, y2, w, h);
            var screenaspect = ( Single )r_newrefdef.width / r_newrefdef.height;

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();
            MYgluPerspective(r_newrefdef.fov_y, screenaspect, 4, 4096);
            GL.CullFace(CullFaceMode.Front);
            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();
            GL.Rotate(-90, 1, 0, 0);
            GL.Rotate(90, 0, 0, 1);
            GL.Rotate(-r_newrefdef.viewangles[2], 1, 0, 0);
            GL.Rotate(-r_newrefdef.viewangles[0], 0, 1, 0);
            GL.Rotate(-r_newrefdef.viewangles[1], 0, 0, 1);
            GL.Translate(-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]);
            GL.GetFloat(GetPName.ModelviewMatrix, r_world_matrix.Array);
            r_world_matrix.Clear();
            if (gl_cull.value != 0F)
            {
                GL.Enable(EnableCap.CullFace);
            }
            else
            {
                GL.Disable(EnableCap.CullFace);
            }
            GL.Disable(EnableCap.Blend);
            GL.Disable(EnableCap.AlphaTest);
            GL.Enable(EnableCap.DepthTest);
        }