public EVRDisplay() { var lTuple = D3D9Image.createD3D9Image(); if (lTuple != null) { this.imageSource = lTuple.Item1; this.surface = lTuple.Item2; } if (this.imageSource != null) { var image = new System.Windows.Controls.Image(); image.Stretch = System.Windows.Media.Stretch.Uniform; image.Source = this.imageSource; this.AddChild(image); Width = this.imageSource.Width; Height = this.imageSource.Height; // To greatly reduce flickering we're only going to AddDirtyRect // when WPF is rendering. System.Windows.Media.CompositionTarget.Rendering += this.CompositionTargetRendering; } }
static public System.Tuple <D3DImage, Interop.Direct3DSurface9> createD3D9Image() { D3D9Image lImageSource = new D3D9Image(); return(lImageSource.init() ? System.Tuple.Create <D3DImage, Interop.Direct3DSurface9>(lImageSource, lImageSource.surface) : null); }