//lightCam是我们定义的一个Camera类,此处代表Projector
        public void SetupMatrix(Projector proj)
        {
            gl.MatrixMode(OpenGL.GL_TEXTURE_MATRIX);
            gl.LoadIdentity();

            gl.PushMatrix();
            float[] biasMatrix = {
                0.5f, 0.0f, 0.0f, 0.0f,
                0.0f, 0.5f, 0.0f, 0.0f,
                0.0f, 0.0f, 0.5f, 0.0f,
                0.5f, 0.5f, 0.5f, 1.0f
            };
            //获得Projector的模型视图矩阵,用于把world space的顶点转换到projector space
            //获得Projector的投影矩阵,用于把projector space的顶点转换到projector clip space

            gl.LoadMatrixf(biasMatrix);

            gl.MultMatrix(proj.projMatrix);
            gl.MultMatrix(proj.modelviewMatrix);

            gl.GetFloat(OpenGL.GL_CURRENT_MATRIX_ARB, matrix);          //获得纹理矩阵

            gl.PopMatrix();
        }
        /// <summary>
        /// Handles the OpenGLInitialized event of the openGLControl control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void openGLControl_OpenGLInitialized(object sender, EventArgs e)
        {
            // Get the OpenGL object.
            OpenGL gl = openGLControl.OpenGL;

            // Initial texture projector.
            projTexture = new ProjectiveTexture(gl);
            projector = new Projector();

            // Initial something for creating texture.
            gl.GenTextures(1, texture_name);
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, texture_name[0]);
            gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR);
            gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR_MIPMAP_LINEAR);
            gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_WRAP_S, OpenGL.GL_CLAMP_TO_EDGE);
            gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_WRAP_T, OpenGL.GL_CLAMP_TO_EDGE);
            gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_GENERATE_MIPMAP_HINT_SGIS, OpenGL.GL_TRUE); // automatic mipmap generation included in OpenGL v1.4
            gl.TexImage2D(OpenGL.GL_TEXTURE_2D,
                0, (int)OpenGL.GL_RGBA8, TEXTURE_WIDTH, TEXTURE_HEIGHT, 0, OpenGL.GL_RGBA, OpenGL.GL_UNSIGNED_BYTE, null);
            gl.BindTexture(OpenGL.GL_TEXTURE_2D, 0);

            // InitFBO
            // create a framebuffer object, you need to delete them when program exits.
            gl.GenFramebuffersEXT(1, framebuffer_name);
            gl.BindFramebufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, framebuffer_name[0]);

            // create a renderbuffer object to store depth info
            // NOTE: A depth renderable image should be attached the FBO for depth test.
            // If we don't attach a depth renderable image to the FBO, then
            // the rendering output will be corrupted because of missing depth test.
            // If you also need stencil test for your rendering, then you must
            // attach additional image to the stencil attachement point, too.
            gl.GenRenderbuffersEXT(1, renderbuffer_name);
            gl.BindRenderbufferEXT(OpenGL.GL_RENDERBUFFER_EXT, renderbuffer_name[0]);
            gl.RenderbufferStorageEXT(OpenGL.GL_RENDERBUFFER_EXT, OpenGL.GL_DEPTH_COMPONENT, TEXTURE_WIDTH, TEXTURE_HEIGHT);
            gl.BindRenderbufferEXT(OpenGL.GL_RENDERBUFFER_EXT, 0);

            // attach a texture to FBO color attachement point
            gl.FramebufferTexture2DEXT(OpenGL.GL_FRAMEBUFFER_EXT,
                OpenGL.GL_COLOR_ATTACHMENT0_EXT, OpenGL.GL_TEXTURE_2D, texture_name[0], 0);

            // attach a renderbuffer to depth attachment point
            gl.FramebufferRenderbufferEXT(OpenGL.GL_FRAMEBUFFER_EXT,
                OpenGL.GL_DEPTH_ATTACHMENT_EXT, OpenGL.GL_RENDERBUFFER_EXT, renderbuffer_name[0]);

            gl.BindFramebufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, 0);

            // initial projection matrix
            gl.MatrixMode(OpenGL.GL_PROJECTION);
            //  Create a perspective transformation.
            gl.Perspective(60.0f, (double)Width / (double)Height, 0.01, 100.0);

            //  Use the 'look at' helper function to position and aim the camera.
            gl.LookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);

            //  Set the clear color.
            gl.ClearColor(0, 0, 0, 0);
        }