Exemplo n.º 1
0
        private static void SetAlphaBlending(AlphaBlendSettings settings)
        {
            SetGLEnableCap(EnableCap.Blend, settings.enabled);

            GL.BlendFunc(settings.sourceFactor, settings.destinationFactor);
            GL.BlendEquationSeparate(settings.blendingEquationRgb, settings.blendingEquationAlpha);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the current OpenGL rendering state based on <paramref name="settings"/>.
        /// </summary>
        /// <param name="settings">The settings used to perform the update</param>
        /// <param name="previousSettings">The settings used for the previous update</param>
        public static void SetAlphaBlending(AlphaBlendSettings settings, AlphaBlendSettings previousSettings)
        {
            if (settings.enabled != previousSettings.enabled)
            {
                SetGLEnableCap(EnableCap.Blend, settings.enabled);
            }

            if (settings.sourceFactor != previousSettings.sourceFactor || settings.destinationFactor != previousSettings.destinationFactor)
            {
                GL.BlendFunc(settings.sourceFactor, settings.destinationFactor);
            }

            if (settings.blendingEquationRgb != previousSettings.blendingEquationRgb || settings.blendingEquationAlpha != previousSettings.blendingEquationAlpha)
            {
                GL.BlendEquationSeparate(settings.blendingEquationRgb, settings.blendingEquationAlpha);
            }
        }