Пример #1
0
        private void Dispatcher_ShutdownStarted(object sender, EventArgs e)
        {
            RenderContext.UpdateRequireWorlds.Remove(WorldSpace);

            if (ImageContainer != null)
            {
                ImageContainer.Dispose();
                ImageContainer = null;
            }
            if (TextureContext != null)
            {
                TextureContext.Dispose();
                TextureContext = null;
            }
            Dispose();
        }
Пример #2
0
 protected override void OnInitialized(EventArgs e)
 {
     base.OnInitialized(e);
     if (RenderContext == null)
     {
         RenderContext = getRenderContext();
     }
     TextureContext = GetTextureTargetContext();
     //TextureContext.BackgroundColor=new Color4(1,0,1,1);
     RenderContext.UpdateRequireWorlds.Add(TextureContext.WorldSpace);
     ImageContainer = new D3DImageContainer();
     ImageContainer.IsFrontBufferAvailableChanged += ImageContainer_IsFrontBufferAvailableChanged;
     TargetImg.Source = ImageContainer;
     ImageContainer.SetBackBufferSlimDX(TextureContext.RenderTarget);
     Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
     BeginRenderingScene();
     //////テスト用コード
     //BasicGrid grid = new BasicGrid();
     //grid.Load(RenderContext);
     //TextureContext.WorldSpace.AddResource(grid);
     //TextureContext.MatrixManager.ViewMatrixManager.CameraPosition = new Vector3(0, 20, -40);
     //TextureContext.MatrixManager.ViewMatrixManager.CameraLookAt = new Vector3(0, 15, 0);
 }