Пример #1
0
        private void RenderFrame()
        {
            //Set the defaul render target and the depth stencil buffers
            device.SetRenderTarget(device.BackBuffer, device.BackDepthBuffer);

            //Specify the ViewPort
            device.ViewPort = new ViewPort(0, 0, Width, Height);

            //Clear the render target and depth stencil buffers
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, new Color4(0, 0, 0, 0), 1, 0);


            //Set the primitive type and vertex buffer
            device.PrimitiveTopology = IAPrimitive.TriangleList;
            device.SetVertexBuffer(0, vertexBuffer, 0);

            //Set the shader program to use
            device.Program = shaderProgram;

            //Pass the tranformation values to the shader code
            input.WorldViewProj = world * view * projection;

            //Draw the geometry
            device.Draw(3, 0);

            //Present the render target buffer to the screen
            device.Present();
        }