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


C# WebGLRenderingContext.disable方法代码示例

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


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

示例1: Application


//.........这里部分代码省略.........
                gl.viewport(0, 0, gl_viewportWidth, gl_viewportWidth);
                gl.useProgram(prog);


                gl.uniformMatrix4fv(gl.getUniformLocation(prog, "prMatrix"),
   false, new Float32Array(prMatrix.getAsArray()));

                rotMat.rotate(xRot / 5, 1, 0, 0);
                rotMat.rotate(yRot / 5, 0, 1, 0);

                yRot = 0;
                xRot = 0;

                gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

                gl.uniform4f(colorLoc, 1, 1, 0, 1);

                drawBall(1, 1, 1); drawBall(-1, 1, 1); drawBall(1, -1, 1);
                drawBall(1, 1, -1); drawBall(-1, -1, 1); drawBall(-1, 1, -1);
                drawBall(1, -1, -1); drawBall(-1, -1, -1);

                mvMatrix.load(rotMat);
                mvMatrix.translate(0, 0, transl);

                gl.uniformMatrix4fv(mvMatLoc, false,
                  new Float32Array(mvMatrix.getAsArray()));

                gl.enable(gl.BLEND);
                gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
                gl.uniform4f(colorLoc, .0f, .0f, .9f, .7f);
                gl.depthMask(false);
                gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);
                gl.depthMask(true);
                gl.disable(gl.BLEND);



                gl.useProgram(line_prog);

                gl.uniformMatrix4fv(gl.getUniformLocation(line_prog, "prMatrix"),
   false, new Float32Array(prMatrix.getAsArray()));

                gl.uniformMatrix4fv(mvMatLineLoc, false,
                  new Float32Array(mvMatrix.getAsArray()));
                gl.drawArrays(gl.LINES, 0, 24);

                gl.flush();
            };
            #endregion


            drawScene();



            #region AtResize
            Action AtResize = delegate
            {
                gl_viewportWidth = Native.window.Width;
                gl_viewportHeight = Native.window.Height;

                prMatrix = new CanvasMatrix4();

                //var aspect = (f)gl_viewportWidth / (f)gl_viewportHeight;
                var aspect = Native.window.aspect;
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:66,代码来源:Application.cs

示例2: Application


//.........这里部分代码省略.........

                        glMatrix.mat4.identity(mvMatrix);


                        glMatrix.mat4.translate(mvMatrix, new float[] { 0.0f, 0.0f, z });

                        glMatrix.mat4.rotate(mvMatrix, degToRad(xRot), new[] { 1f, 0f, 0f });
                        glMatrix.mat4.rotate(mvMatrix, degToRad(yRot), new[] { 0f, 1f, 0f });


                        gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);
                        gl.vertexAttribPointer((uint)shaderProgram_vertexPositionAttribute, cubeVertexPositionBuffer_itemSize, gl.FLOAT, false, 0, 0);

                        #region new in lesson 07
                        gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexNormalBuffer);
                        gl.vertexAttribPointer((uint)shaderProgram_vertexNormalAttribute, cubeVertexNormalBuffer_itemSize, gl.FLOAT, false, 0, 0);
                        #endregion

                        gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexTextureCoordBuffer);
                        gl.vertexAttribPointer((uint)shaderProgram_textureCoordAttribute, cubeVertexTextureCoordBuffer_itemSize, gl.FLOAT, false, 0, 0);


                        gl.activeTexture(gl.TEXTURE0);
                        gl.bindTexture(gl.TEXTURE_2D, textures[filter]);
                        gl.uniform1i(shaderProgram_samplerUniform, 0);

                        #region new in lesson 08

                        var blending = [email protected];
                        if (blending)
                        {
                            gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
                            gl.enable(gl.BLEND);
                            gl.disable(gl.DEPTH_TEST);
                            gl.uniform1f(shaderProgram_alphaUniform, toolbar.alpha);
                        }
                        else
                        {
                            gl.disable(gl.BLEND);
                            gl.enable(gl.DEPTH_TEST);
                        }

                        #endregion


                        var lighting = [email protected];
                        gl.uniform1i(shaderProgram_useLightingUniform, lighting.ToInt32());
                        if (lighting)
                        {
                            gl.uniform3f(
                                shaderProgram_ambientColorUniform,
                                toolbar.ambientR,
                                toolbar.ambientG,
                                toolbar.ambientB
                            );

                            var lightingDirection = new float []{
                                toolbar.lightDirectionX,
                                toolbar.lightDirectionY,
                                toolbar.lightDirectionZ
                            };
                            var adjustedLD = glMatrix.vec3.create();
                            glMatrix.vec3.normalize(lightingDirection, adjustedLD);
                            glMatrix.vec3.scale(adjustedLD, new f[] {-1});
                            gl.uniform3fv(shaderProgram_lightingDirectionUniform, adjustedLD);
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:66,代码来源:Application.cs


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