3 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGL
5 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
6 using OpenTK.Graphics.ES30;
8 using OpenTK.Graphics.OpenGL;
11 namespace SiliconStudio.
Paradox.Graphics
13 public partial class RasterizerState
15 #if !SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
16 private PolygonMode polygonMode;
19 private RasterizerState(GraphicsDevice device, RasterizerStateDescription rasterizerStateDescription) : base(device)
21 Description = rasterizerStateDescription;
23 #if !SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
24 polygonMode = Description.FillMode == FillMode.Solid ? PolygonMode.Fill : PolygonMode.Line;
28 if (Description.DepthBiasClamp != 0.0f)
throw new NotSupportedException();
32 protected internal override bool OnRecreate()
40 #if !SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
41 GL.PolygonMode(MaterialFace.FrontAndBack, polygonMode);
43 GL.PolygonOffset(Description.DepthBias, Description.SlopeScaleDepthBias);
45 if (Description.CullMode ==
CullMode.None)
46 GL.Disable(EnableCap.CullFace);
49 GL.Enable(EnableCap.CullFace);
50 GL.CullFace(GetCullMode(Description.CullMode));
54 if (Description.ScissorTestEnable)
55 GL.Enable(EnableCap.ScissorTest);
57 GL.Disable(EnableCap.ScissorTest);
60 public static CullFaceMode GetCullMode(
CullMode cullMode)
65 return CullFaceMode.Front;
67 return CullFaceMode.Back;
70 return CullFaceMode.FrontAndBack;
CullMode
Indicates triangles facing a particular direction are not drawn.