Beispiel #1
0
        private static void SetDepthTesting(DepthTestSettings settings)
        {
            SetGLEnableCap(EnableCap.DepthTest, settings.enabled);

            GL.DepthFunc(settings.depthFunction);
            GL.DepthMask(settings.depthMask);
        }
        /// <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 SetDepthTesting(DepthTestSettings settings, DepthTestSettings previousSettings)
        {
            if (settings.enabled != previousSettings.enabled)
            {
                SetGLEnableCap(EnableCap.DepthTest, settings.enabled);
            }

            if (settings.depthFunction != previousSettings.depthFunction)
            {
                GL.DepthFunc(settings.depthFunction);
            }

            if (settings.depthMask != previousSettings.depthMask)
            {
                GL.DepthMask(settings.depthMask);
            }
        }