/// <summary> /// Determines which version of OpenGL will be used by the context. /// </summary> private void InitOpenGLVersion(OpenGLGraphicsConfiguration configuration, out Version versionRequested, out Version versionRequired, out Boolean isGLES) { isGLES = (Ultraviolet.Platform == UltravioletPlatform.Android || Ultraviolet.Platform == UltravioletPlatform.iOS); versionRequired = isGLES ? new Version(2, 0) : new Version(3, 1); versionRequested = isGLES ? configuration.MinimumOpenGLESVersion : configuration.MinimumOpenGLVersion; if (versionRequested != null && versionRequested < versionRequired) { versionRequested = versionRequired; } }
/// <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; } } }
/// <summary> /// Initializes a new instance of the <see cref="OpenGLGraphicsPlugin"/> class. /// </summary> /// <param name="configuration">The graphics configuration settings.</param> public OpenGLGraphicsPlugin(OpenGLGraphicsConfiguration configuration = null) { this.configuration = configuration ?? OpenGLGraphicsConfiguration.Default; }