public void ClearColorDepth() { using (GraphicsWindow window = Device.CreateWindow(1, 1)) using (Framebuffer framebuffer = TestUtility.CreateFramebuffer(window.Context)) using (Texture2D depthTexture = Device.CreateTexture2D(new Texture2DDescription(1, 1, TextureFormat.Depth32f, false))) { framebuffer.DepthAttachment = depthTexture; window.Context.Framebuffer = framebuffer; window.Context.Clear(new ClearState() { Buffers = ClearBuffers.All, Color = Color.Red, Depth = 0.5f }); TestUtility.ValidateColor(framebuffer.ColorAttachments[0], 255, 0, 0); ValidateDepth(framebuffer.DepthAttachment, 0.5f); // // Scissor out window and verify clear doesn't modify contents // ScissorTest scissorTest = new ScissorTest(); scissorTest.Enabled = true; scissorTest.Rectangle = new Rectangle(0, 0, 0, 0); window.Context.Clear(new ClearState() { ScissorTest = scissorTest, Buffers = ClearBuffers.All, Color = Color.Blue, Depth = 1 }); TestUtility.ValidateColor(framebuffer.ColorAttachments[0], 255, 0, 0); ValidateDepth(framebuffer.DepthAttachment, 0.5f); } }
public void ScissorTest() { ScissorTest scissorTest = new ScissorTest(); scissorTest.Enabled = true; scissorTest.Rectangle = new Rectangle(0, 1, 2, 3); Assert.IsTrue(scissorTest.Enabled); Assert.AreEqual(new Rectangle(0, 1, 2, 3), scissorTest.Rectangle); }
public ClearState() { ScissorTest = new ScissorTest(); ColorMask = new ColorMask(true, true, true, true); DepthMask = true; FrontStencilMask = ~0; BackStencilMask = ~0; Buffers = ClearBuffers.All; Color = Color.White; Depth = 1; Stencil = 0; }
public RenderState() { PrimitiveRestart = new PrimitiveRestart(); FacetCulling = new FacetCulling(); ProgramPointSize = ProgramPointSize.Disabled; RasterizationMode = RasterizationMode.Fill; ScissorTest = new ScissorTest(); StencilTest = new StencilTest(); DepthTest = new DepthTest(); DepthRange = new DepthRange(); Blending = new Blending(); ColorMask = new ColorMask(true, true, true, true); DepthMask = true; }