当前位置: 首页>>代码示例>>C#>>正文


C# OpenGL.ClearColor方法代码示例

本文整理汇总了C#中OpenGL.ClearColor方法的典型用法代码示例。如果您正苦于以下问题:C# OpenGL.ClearColor方法的具体用法?C# OpenGL.ClearColor怎么用?C# OpenGL.ClearColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenGL的用法示例。


在下文中一共展示了OpenGL.ClearColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetAttributes

        /// <summary>
        /// Sets the attributes.
        /// </summary>
        /// <param name="gl">The OpenGL instance.</param>
        public override void SetAttributes(OpenGL gl)
        {
            if(enableAlphaTest.HasValue && alphaTestFunction.HasValue && alphaTestReferenceValue.HasValue) 
            {
                gl.EnableIf(OpenGL.GL_ALPHA_TEST, enableAlphaTest.Value);
                gl.AlphaFunc(alphaTestFunction.Value, alphaTestReferenceValue.Value);
            }
            
            if(enableBlend.HasValue && blendingSourceFactor.HasValue && blendingDestinationFactor.HasValue) 
            {
                gl.EnableIf(OpenGL.GL_BLEND, enableBlend.Value);
                gl.BlendFunc(blendingSourceFactor.Value, blendingDestinationFactor.Value);
            }

            if(enableDither.HasValue) gl.EnableIf(OpenGL.GL_DITHER, enableDither.Value);
            if(drawBufferMode.HasValue) gl.DrawBuffer(drawBufferMode.Value);
            
            if(enableLogicOp.HasValue && logicOp.HasValue) 
            {
                gl.EnableIf(OpenGL.GL_COLOR_LOGIC_OP, enableLogicOp.Value);
                gl.LogicOp(logicOp.Value);
            }
            if(colorModeClearColor != null) gl.ClearColor(colorModeClearColor.R, colorModeClearColor.G, colorModeClearColor.B, colorModeClearColor.A);
            //todowritemask
        }
开发者ID:cvanherk,项目名称:3d-engine,代码行数:29,代码来源:ColorBufferAttributes.cs

示例2: Initialise

        /// <summary>
        /// Initialises the scene.
        /// </summary>
        /// <param name="gl">The OpenGL instance.</param>
        /// <param name="width">The width of the screen.</param>
        /// <param name="height">The height of the screen.</param>
        public void Initialise(OpenGL gl, float width, float height)
        {
            //  Set a blue clear colour.
            gl.ClearColor(0.4f, 0.6f, 0.9f, 0.0f);

            //  Create the shader program.
            var vertexShaderSource = ManifestResourceLoader.LoadTextFile("Shader.vert");
            var fragmentShaderSource = ManifestResourceLoader.LoadTextFile("Shader.frag");
            shaderProgram = new ShaderProgram();
            shaderProgram.Create(gl, vertexShaderSource, fragmentShaderSource, null);
            shaderProgram.BindAttributeLocation(gl, attributeIndexPosition, "in_Position");
            shaderProgram.BindAttributeLocation(gl, attributeIndexColour, "in_Color");
            shaderProgram.AssertValid(gl);

            //  Create a perspective projection matrix.
            const float rads = (60.0f / 360.0f) * (float)Math.PI * 2.0f;
            projectionMatrix = glm.perspective(rads, width / height, 0.1f, 100.0f);

            //  Create a view matrix to move us back a bit.
            viewMatrix = glm.translate(new mat4(1.0f), new vec3(0.0f, 0.0f, -5.0f));

            //  Create a model matrix to make the model a little bigger.
            modelMatrix = glm.scale(new mat4(1.0f), new vec3(2.5f));

            //  Now create the geometry for the square.
            CreateVerticesForSquare(gl);
        }
开发者ID:chantsunman,项目名称:sharpgl,代码行数:33,代码来源:Scene.cs


注:本文中的OpenGL.ClearColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。