/// <summary>
        /// Convenience function that creates the required objects to initialise the
        /// CEGUI system.
        ///
        /// The created Renderer will use the current OpenGL viewport as it's
        /// default surface size.
        ///
        /// This will create and initialise the following objects for you:
        /// - CEGUI::OpenGLRenderer
        /// - CEGUI::DefaultResourceProvider
        /// - CEGUI::System
        /// </summary>
        /// <param name="textureTargetType">
        /// Specifies one of the TextureTargetType enumerated values indicating the
        /// desired TextureTarget type to be used.  Defaults to TTT_AUTO.
        /// </param>
        /// <param name="abi">This must be set to CEGUI_VERSION_ABI</param>
        /// <returns>
        /// Reference to the CEGUI::OpenGLRenderer object that was created.
        /// </returns>
        public static OpenGLRenderer BootstrapSystem(TextureTargetType textureTargetType = TextureTargetType.TTT_AUTO /*, int abi = CEGUI_VERSION_ABI*/)
        {
            // TODO: System::performVersionTest(CEGUI_VERSION_ABI, abi, CEGUI_FUNCTION_NAME);

            if (Base.System.GetSingleton() != null)
            {
                throw new InvalidRequestException("CEGUI::System object is already initialised.");
            }

            var renderer = Create(textureTargetType);

            Base.System.Create(renderer, new DefaultResourceProvider());

            return(renderer);
        }
        /// <summary>
        /// Constructor for OpenGL Renderer objects
        /// </summary>
        /// <param name="textureTargetType">
        /// Specifies one of the TextureTargetType enumerated values indicating the
        /// desired TextureTarget type to be used.
        /// </param>
        private OpenGLRenderer(TextureTargetType textureTargetType)
        {
            InitialiseRendererIDString();
            InitialiseGLExtensions();
            InitialiseTextureTargetFactory(textureTargetType);
            InitialiseShaderWrappers();

            // we _really_ need separate rgb/alpha blend modes, if this support is not
            // available, add a note to the renderer ID string so that this fact is
            // logged.
            if (!GLEW_VERSION_1_4 && !GLEW_EXT_blend_func_separate)
            {
                d_rendererID += "  No glBlendFuncSeparate(EXT) support.";
            }
        }
        //! initialise OGLTextureTargetFactory that will generate TextureTargets
        private void InitialiseTextureTargetFactory(TextureTargetType textureTargetType)
        {
            // prefer FBO

            if (((textureTargetType == TextureTargetType.TTT_AUTO) || (textureTargetType == TextureTargetType.TTT_FBO)) && GLEW_EXT_framebuffer_object)
            {
                d_rendererID         += "  TextureTarget support enabled via FBO extension.";
                _textureTargetFactory = x => new OpenGLFBOTextureTarget((OpenGLRenderer)x);
            }

            //#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
            //    // on linux (etc), we can try for GLX pbuffer support
            //    else if (((tt_type == TTT_AUTO) || (tt_type == TTT_PBUFFER)) &&
            //             GLXEW_VERSION_1_3)
            //    {
            //        d_rendererID += "  TextureTarget support enabled via GLX pbuffers.";
            //        d_textureTargetFactory =
            //            CEGUI_NEW_AO OGLTemplateTargetFactory<OpenGLGLXPBTextureTarget>;
            //    }
            //#elif defined(_WIN32) || defined(__WIN32__)
            else if (((textureTargetType == TextureTargetType.TTT_AUTO) || (textureTargetType == TextureTargetType.TTT_PBUFFER)) && WGLEW_ARB_pbuffer)
            {
                // on Windows, we can try for WGL based pbuffer support

                d_rendererID         += "  TextureTarget support enabled via WGL_ARB_pbuffer.";
                _textureTargetFactory = x => new OpenGLWGLPBTextureTarget((OpenGLRenderer)x);
            }
            //#elif defined(__APPLE__)
            //    // on Apple Mac, we can try for Apple's pbuffer support
            //    else if (((tt_type == TTT_AUTO) || (tt_type == TTT_PBUFFER)) &&
            //             GLEW_APPLE_pixel_buffer)
            //    {
            //        d_rendererID += "  TextureTarget support enabled via "
            //                        "GL_APPLE_pixel_buffer.";
            //        d_textureTargetFactory =
            //            CEGUI_NEW_AO OGLTemplateTargetFactory<OpenGLApplePBTextureTarget>;
            //    }
            //#endif
            // Nothing suitable available, try to carry on without TextureTargets
            else
            {
                d_rendererID         += "  TextureTarget support is not available :(";
                _textureTargetFactory = x => null;
            }
        }
        /*!
         * \brief
         *  Create an OpenGLRenderer object.
         *
         * \param display_size
         *  Size object describing the initial display resolution.
         *
         * \param tt_type
         *  Specifies one of the TextureTargetType enumerated values indicating the
         *  desired TextureTarget type to be used.
         *
         * \param abi
         *  This must be set to CEGUI_VERSION_ABI
         */
        public static OpenGLRenderer Create(Sizef displaySize, TextureTargetType textureTargetType = TextureTargetType.TTT_AUTO /*, int abi = CEGUI_VERSION_ABI*/)
        {
            // TODO: System::performVersionTest(CEGUI_VERSION_ABI, abi, CEGUI_FUNCTION_NAME);

            return(new OpenGLRenderer(displaySize, textureTargetType));
        }