Example #1
0
        private void openGLControl1_Resized(object sender, EventArgs e)
        {
            OpenGL gl = openGLControl1.OpenGL;

            //set ma tran viewport
            gl.Viewport(
                0, 0,
                openGLControl1.Width,
                openGLControl1.Height);

            gl.LoadIdentity();

            //set ma tran phep chieu
            gl.MatrixMode(OpenGL.GL_PROJECTION);
            gl.Perspective(cameraAngle,
                           openGLControl1.Width / openGLControl1.Height,
                           1.0, 100.0);

            //set ma tran model view
            gl.MatrixMode(OpenGL.GL_MODELVIEW);
            gl.LookAt(cameraPosition[0], cameraPosition[1], cameraPosition[2],
                      viewPosition[0], viewPosition[1], viewPosition[2],
                      0, 0, 1);
        }