Example #1
0
 void RenderIt(object sender, TextureRenderEventArgs e)
 {
     lock (this)
     {
         // Set our texture so we can render it
         texture = e.Texture;
         RenderTexture();
     }
 }
 void _video_TextureReadyToRender(object sender, TextureRenderEventArgs e)
 {
     _device.BeginScene();
     _device.SetTexture(0, e.Texture);
     _device.VertexFormat = CustomVertex.PositionTextured.Format;
     _device.DrawUserPrimitives(PrimitiveType.TriangleList, 2, vertices);
     font.DrawText(null, "test overlay", 5, 5, Color.Red);
     _device.EndScene();
     _device.Present();
 }
Example #3
0
 void movie_TextureReadyToRender(object sender, TextureRenderEventArgs e)
 {
     if (movieplaying)
     {
         device.Clear(ClearFlags.Target, Color.Black, 1.0f, 0);
         device.BeginScene();
         device.VertexFormat = CustomVertex.PositionTextured.Format;
         device.SetTexture(0, e.Texture);
         device.VertexFormat = CustomVertex.TransformedTextured.Format;
         device.SetStreamSource(0, vertices, 0);
         device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
         device.EndScene();
         device.Present();
     }
 }
Example #4
0
        /// <summary>
        /// Fired when the video has a frame ready to be rendered into the texture
        /// </summary>
        void RenderIt(object sender, TextureRenderEventArgs e)
        {
            lock (this)
            {
                Device device = sampleFramework.Device;
                // We will be updating the texture now
                using (e.Texture)
                {
                    if (!canRender)
                    {
                        return; // Cannot render right now
                    }
                    bool beginSceneCalled = false;
                    // Clear the render target and the zbuffer
                    device.Clear(ClearFlags.ZBuffer | ClearFlags.Target, 0x000000ff, 1.0f, 0);

                    try
                    {
                        device.BeginScene();
                        beginSceneCalled = true;

                        // Make sure this isn't being updated at this time
                        // Setup the world matrix
                        device.Transform.World = Matrix.RotationAxis(new Vector3((float)Math.Cos(Environment.TickCount / 250.0f), 1, (float)Math.Sin(Environment.TickCount / 250.0f)), Environment.TickCount / 1000.0f);

                        // Set the texture
                        device.SetTexture(0, e.Texture);
                        device.SetStreamSource(0, vertexBuffer, 0);
                        device.VertexFormat = CustomVertex.PositionNormalTextured.Format;
                        device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, (4 * 25) - 2);
                    }
                    finally
                    {
                        if (beginSceneCalled)
                        {
                            device.EndScene();
                        }
                    }

                    device.Present();
                }
            }
        }