Ejemplo n.º 1
0
        protected override void OnSizeChanged(EventArgs e)
        {
            Size sz = Size;

            if (sz.Width != 0 && sz.Height != 0)
            {
                fHeight = sz.Height;
                fWidth  = sz.Width;

                if (fHeight == 0)
                {
                    fHeight = 1;
                }

                OpenGL.glViewport(0, 0, fWidth, fHeight);
                OpenGL.glMatrixMode(OpenGL.GL_PROJECTION);
                OpenGL.glLoadIdentity();

                GLU.gluPerspective(FOV_Y, (float)fWidth / fHeight, NEAR_CLIPPING_PLANE, FAR_CLIPPING_PLANE);

                OpenGL.glMatrixMode(OpenGL.GL_MODELVIEW);
                OpenGL.glLoadIdentity();
            }

            base.OnSizeChanged(e);
        }
Ejemplo n.º 2
0
        private void initPerspective()
        {
            GL.glMatrixMode(GL.GL_PROJECTION);
            GL.glLoadIdentity();

            GLU.gluPerspective(m_fovyAngle, m_width / m_height, 1, 3000);

            GL.glMatrixMode(GL.GL_MODELVIEW);
            GL.glLoadIdentity();
        }
        public void applyCamera()
        {
            // Set up projection matrix
            GL.glMatrixMode(GL.GL_PROJECTION);
            GL.glLoadIdentity();
            GLU.gluPerspective(FieldAngle * 360.0f / (2.0f * (float)Math.PI), AspectRatio, NearClip, FarClip);
            GLU.gluLookAt(px, py, pz, tx, ty, tz, ux, uy, uz);
            GL.glMatrixMode(GL.GL_MODELVIEW);

            // Render skybox (assume texture already bound)
            GL.glLoadIdentity();
            skybox.render();
        }
Ejemplo n.º 4
0
        public override void SetViewport(int width, int height, float fovY, float zNear, float zFar)
        {
            if (width > 0 && height > 0)
            {
                OpenGL.glViewport(0, 0, width, height);
                OpenGL.glMatrixMode(OpenGL.GL_PROJECTION);
                OpenGL.glLoadIdentity();

                GLU.gluPerspective(fovY, (float)width / height, zNear, zFar);

                OpenGL.glMatrixMode(OpenGL.GL_MODELVIEW);
                OpenGL.glLoadIdentity();
            }
        }