/// <summary>
        /// Sets the OpenGL environment attributes which correspond to the application's OpenGL settings.
        /// </summary>
        private void InitOpenGLEnvironment(OpenGLGraphicsConfiguration configuration, Boolean isGLES)
        {
            if (!OpenGLEnvironment.RequestOpenGLProfile(isGLES))
            {
                OpenGLEnvironment.ThrowPlatformErrorException();
            }

            if (!OpenGLEnvironment.RequestDepthSize(configuration.BackBufferDepthSize))
            {
                OpenGLEnvironment.ThrowPlatformErrorException();
            }

            if (!OpenGLEnvironment.RequestStencilSize(configuration.BackBufferStencilSize))
            {
                OpenGLEnvironment.ThrowPlatformErrorException();
            }

            if (configuration.Use32BitFramebuffer)
            {
                if (!OpenGLEnvironment.Request32BitFramebuffer())
                {
                    OpenGLEnvironment.ThrowPlatformErrorException();
                }
            }
            else
            {
                if (!OpenGLEnvironment.Request24BitFramebuffer())
                {
                    OpenGLEnvironment.ThrowPlatformErrorException();
                }
            }

            if (configuration.SrgbBuffersEnabled)
            {
                if (!OpenGLEnvironment.RequestSrgbCapableFramebuffer())
                {
                    OpenGLEnvironment.ThrowPlatformErrorException();
                }

                if (!OpenGLEnvironment.IsFramebufferSrgbCapable)
                {
                    configuration.SrgbBuffersEnabled = false;
                }
            }
        }