public void Init()
    {
        PresentParameters present_params = new PresentParameters();

        present_params.Windowed   = true;
        present_params.SwapEffect = SwapEffect.Discard;
        _device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, present_params);
        font    = new Microsoft.DirectX.Direct3D.Font(_device, 20, 0, FontWeight.Bold, 0, false, CharacterSet.Default, Precision.Default, FontQuality.Default, PitchAndFamily.DefaultPitch, "Arial");
        _video  = new Video("clock.avi");
        _video.TextureReadyToRender += new TextureRenderEventHandler(_video_TextureReadyToRender);
        _video.RenderToTexture(_device);

        vertices             = new CustomVertex.PositionTextured[6];
        vertices[0].Position = new Vector3(1f, 1f, 0f);
        vertices[0].Tu       = 0;
        vertices[0].Tv       = 1;
        vertices[1].Position = new Vector3(-1f, -1f, 0f);
        vertices[1].Tu       = 1;
        vertices[1].Tv       = 1;
        vertices[2].Position = new Vector3(1f, -1f, 0f);
        vertices[2].Tu       = 0;
        vertices[2].Tv       = 0;
        vertices[3].Position = new Vector3(-1.1f, -0.99f, 0f);
        vertices[3].Tu       = 1;
        vertices[3].Tv       = 0;
        vertices[4].Position = new Vector3(0.99f, 1.1f, 0f);
        vertices[4].Tu       = 0;
        vertices[4].Tv       = 0;
        vertices[5].Position = new Vector3(-1.1f, 1.1f, 0f);
        vertices[5].Tu       = 1;
        vertices[5].Tv       = 1;
    }
Esempio n. 2
0
        void CreateVideoObject()
        {
            if (video != null)
            {
                video.TextureReadyToRender -= new Microsoft.DirectX.AudioVideoPlayback.TextureRenderEventHandler(video_TextureReadyToRender);
                video.Ending -= new EventHandler(video_Ending);
                video.Dispose();
                video = null;
            }

            video = new Microsoft.DirectX.AudioVideoPlayback.Video("mms://stream1.halsc.com/mitomitomi/test.wmv", true);
            //video = new Microsoft.DirectX.AudioVideoPlayback.Video("mms://10.0.1.173:8070", true);
            video.TextureReadyToRender += new Microsoft.DirectX.AudioVideoPlayback.TextureRenderEventHandler(video_TextureReadyToRender);
            video.Ending += new EventHandler(video_Ending);
            video.RenderToTexture(d3ddevice);
        }