本文整理汇总了C#中RenderMode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# RenderMode.ToString方法的具体用法?C# RenderMode.ToString怎么用?C# RenderMode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderMode
的用法示例。
在下文中一共展示了RenderMode.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetMode
public void SetMode(RenderMode m)
{
CheckError();
switch (m)
{
case RenderMode.Draw2D:
States.Disable((int)GetPName.PointSprite);
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
GL.MatrixMode(MatrixMode.Projection);
global::OpenTK.Matrix4 m2 = global::OpenTK.Matrix4.CreateOrthographicOffCenter(0.0f, (float)width, (float)height, 0.0f, -1.0f, 1000.0f);
GL.LoadMatrix(ref m2);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
States.Disable((int)GetPName.DepthTest);
States.Disable((int)GetPName.CullFace);
States.Disable((int)GetPName.Lighting);
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
States.Enable((int)GetPName.Blend);
break;
case RenderMode.Draw3D:
GL.DepthMask(true);
States.Disable((int)GetPName.PointSprite);
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
States.ActiveTexture((int)TextureUnit.Texture0);
States.Enable((int)GetPName.DepthTest);
States.Enable((int)GetPName.CullFace);
GL.CullFace(CullFaceMode.Back);
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
States.Enable((int)GetPName.Blend);
GL.LightModel(LightModelParameter.LightModelTwoSide, 1);
break;
case RenderMode.Draw3DWireFrame:
GL.DepthMask(true);
States.Disable((int)GetPName.PointSprite);
States.ActiveTexture((int)TextureUnit.Texture0);
States.Enable((int)GetPName.DepthTest);
States.Enable((int)GetPName.CullFace);
GL.CullFace(CullFaceMode.Back);
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
States.Enable((int)GetPName.Blend);
GL.LightModel(LightModelParameter.LightModelTwoSide, 1);
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
break;
case RenderMode.Draw3DPointSprite:
States.ActiveTexture((int)TextureUnit.Texture0);
GL.TexEnv(TextureEnvTarget.PointSprite, TextureEnvParameter.CoordReplace, 1);
States.Enable((int)GetPName.PointSprite);
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
UseShader(pointsprite);
float m1 = 2.0f * (float)Math.Atan(cam.Fov / 2.0 / 180.0 * Math.PI);
int[] vp = new int[4];
GL.GetInteger(GetPName.Viewport, vp);
float v = (float)vp[3];
m1 /= v;
SetUniform(pointsprite.GetUniformLocation("WorldSize"), new float[] { pointsize });
SetUniform(pointsprite.GetUniformLocation("Attenuation"), new float[] { 0,0,m1 });
break;
case RenderMode.DrawSkyBox:
States.Disable((int)GetPName.PointSprite);
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
States.ActiveTexture((int)TextureUnit.Texture0);
States.Enable((int)GetPName.CullFace);
GL.CullFace(CullFaceMode.Back);
GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
States.Enable((int)GetPName.Blend);
GL.LightModel(LightModelParameter.LightModelTwoSide, 1);
States.Disable((int)GetPName.DepthTest);
GL.DepthMask(false);
break;
default:
throw new Exception("dont know rendermode " + m.ToString());
}
CheckError();
}