public void Draw() { Device.Reset(); VertexBuffer[0].Update <Vertex>(Grid.Vertices.ToArray()); IndexBuffer[0].Update <int>(Grid.Indices.ToArray()); VertexBuffer[1].Update <Vertex>(Mesh.Vertices.ToArray()); IndexBuffer[1].Update <int>(Mesh.Indices.ToArray()); CommandList.ClearDepthStencilView(Texture, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil); CommandList.SetRenderTargets(Texture); //Clear our backbuffer to the updated color CommandList.Clear(Texture, new Color4(0.0f, 0.2f, 0.4f, 1)); CommandList.SetInputLayout(Shaders.Layout); CommandList.SetViewPort(SwapChain.PresentParameters.Width, SwapChain.PresentParameters.Height, 0, 0); CommandList.SetVertexShader(Shaders.VertexShader); CommandList.SetPixelShader(Shaders.PixelShader); //---Draw Grid #2 CommandList.SetVertexBuffer(VertexBuffer[0]); CommandList.SetIndexBuffer(IndexBuffer[0]); ConstantBuffer.UpdateConstant <Transform>(ShaderType.VertexShader, 0, new Transform(World[0], Camera.View, Camera.Projection)); // cbuffer MatrixBuffer (W V P) : register(b0) CommandList.SetPrimitiveType(SharpDX.Direct3D.PrimitiveTopology.TriangleList); CommandList.SetRasterizerState(StateSolid); CommandList.SetSampler(ShaderType.PixelShader, SamplerState, 0); CommandList.SetShaderResource(ShaderType.PixelShader, Textures[0], 0); CommandList.DrawIndexed(Grid.IndexCount); //---Draw Grid #2 CommandList.SetVertexBuffer(VertexBuffer[1]); CommandList.SetIndexBuffer(IndexBuffer[1]); ConstantBuffer.UpdateConstant <Transform>(ShaderType.VertexShader, 0, new Transform(World[1], Camera.View, Camera.Projection)); // cbuffer MatrixBuffer (W V P) : register(b0) CommandList.SetPrimitiveType(SharpDX.Direct3D.PrimitiveTopology.TriangleList); CommandList.SetRasterizerState(StateWireframe); CommandList.SetSampler(ShaderType.PixelShader, SamplerState, 0); CommandList.SetShaderResource(ShaderType.PixelShader, Textures[1], 0); CommandList.DrawIndexed(Mesh.IndexCount); }