public TextureForm( string filePath )
        {
            InitializeComponent( );

            m_RenderState = Graphics.Factory.CreateRenderState( );
            m_RenderState.Enable2dTextures = true;
            m_RenderState.Enable2dTextureUnit( 0, true );
            m_RenderState.Colour = Color.Red;
            m_FilePath = filePath;
        }
        /// <summary>
        /// Renders the grid as a texture
        /// </summary>
        private void RenderTexture( )
        {
            if ( m_TextureState == null )
            {
                m_TextureState = Graphics.Factory.CreateRenderState( );
                m_TextureState.Lighting = false;
                m_TextureState.Enable2dTextures = true;
                m_TextureState.Enable2dTextureUnit(0, true );

                ITexture2d texture = Graphics.Factory.CreateTexture2d( );
                texture.Load( GridSquareBitmap, true, TextureUsage.Normal );

                m_Sampler = Graphics.Factory.CreateTexture2dSampler( );
                m_Sampler.Texture = texture;
                m_Sampler.Mode = TextureMode.Replace;
                m_Sampler.MinFilter = TextureFilter.NearestTexelLinearMipMap;
                m_Sampler.MagFilter = TextureFilter.NearestTexelLinearMipMap;
                m_Sampler.WrapS = TextureWrap.Repeat;
                m_Sampler.WrapT = TextureWrap.Repeat;
            }

            //	For the moment, let's just render a giant quad with a texture :(
            //	TODO: AP: Render a grid of quads centered on the camera position projected onto the ground plane
            Graphics.Renderer.PushRenderState( m_TextureState );
            m_Sampler.Begin( );

            Gl.glBegin( Gl.GL_QUADS );

            Gl.glTexCoord2f( MinU, MinV );
            Gl.glVertex3f( MinX, Y, MinZ );

            Gl.glTexCoord2f( MaxU, MinV );
            Gl.glVertex3f( MaxX, Y, MinZ );

            Gl.glTexCoord2f( MaxU, MaxV );
            Gl.glVertex3f( MaxX, Y, MaxZ );

            Gl.glTexCoord2f( MinU, MaxV );
            Gl.glVertex3f( MinX, Y, MaxZ );

            Gl.glEnd( );

            m_Sampler.End( );
            Graphics.Renderer.PopRenderState( );
        }