示例#1
0
    /// <summary> Initializes Direct3D-OCCT rendering. </summary>
    private void BeginRenderingScene ()
    {
      if (myIsFailed)
      {
        return;
      }

      if (myD3DImage.IsFrontBufferAvailable)
      {
        IntPtr aWinHandle;
        IntPtr aD3DDevice;

        // Initialize Direct3D device and render target
        myD3DRender = Direct3DProxy.InitRender(out aWinHandle, out aD3DDevice);

        Viewer = new OCCViewer();

        if (!Viewer.InitInterop (aWinHandle, aD3DDevice))
        {
          MessageBox.Show ("Failed to initialize OpenGL-Direct3D interoperability!",
            "Error", MessageBoxButton.OK, MessageBoxImage.Error);

          myIsFailed = true;

          if (myD3DRender != IntPtr.Zero)
              Direct3DProxy.ReleaseRender(ref myD3DRender);

          return;
        }

        // Leverage the Rendering event of WPF composition
        // target to update the our custom Direct3D scene
        CompositionTarget.Rendering += OnRendering;
      }
    }
        /// <summary> Initializes Direct3D-OCCT rendering. </summary>
        private void BeginRenderingScene()
        {
            if (myIsFailed)
            {
                return;
            }

            if (myD3DImage.IsFrontBufferAvailable)
            {
                Viewer = new OCCViewer();

                if (!Viewer.InitViewer())
                {
                    MessageBox.Show("Failed to initialize OpenGL-Direct3D interoperability!",
                                    "Error", MessageBoxButton.OK, MessageBoxImage.Error);

                    myIsFailed = true;
                    return;
                }

                // Leverage the Rendering event of WPF composition
                // target to update the our custom Direct3D scene
                CompositionTarget.Rendering += OnRendering;
            }
        }
示例#3
0
    /// <summary> Initializes Direct3D-OCCT rendering. </summary>
    private void BeginRenderingScene ()
    {
      if (myIsFailed)
      {
        return;
      }

      if (myD3DImage.IsFrontBufferAvailable)
      {
        Viewer = new OCCViewer();

        if (!Viewer.InitViewer())
        {
          MessageBox.Show ("Failed to initialize OpenGL-Direct3D interoperability!",
            "Error", MessageBoxButton.OK, MessageBoxImage.Error);

          myIsFailed = true;
          return;
        }

        // Leverage the Rendering event of WPF composition
        // target to update the our custom Direct3D scene
        CompositionTarget.Rendering += OnRendering;
      }
    }
        /// <summary> Initializes Direct3D-OCCT rendering. </summary>
        private void BeginRenderingScene()
        {
            if (myIsFailed)
            {
                return;
            }

            if (myD3DImage.IsFrontBufferAvailable)
            {
                IntPtr aWinHandle;
                IntPtr aD3DDevice;

                // Initialize Direct3D device and render target
                myD3DRender = Direct3DProxy.InitRender(out aWinHandle, out aD3DDevice);

                Viewer = new OCCViewer();

                if (!Viewer.InitInterop(aWinHandle, aD3DDevice))
                {
                    MessageBox.Show("Failed to initialize OpenGL-Direct3D interoperability!",
                                    "Error", MessageBoxButton.OK, MessageBoxImage.Error);

                    myIsFailed = true;

                    if (myD3DRender != IntPtr.Zero)
                    {
                        Direct3DProxy.ReleaseRender(ref myD3DRender);
                    }

                    return;
                }

                // Leverage the Rendering event of WPF composition
                // target to update the our custom Direct3D scene
                CompositionTarget.Rendering += OnRendering;
            }
        }
示例#5
0
        private void OnViewerChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.RemovedItems.Count > 0)
            {
                Grid aHost = ((e.RemovedItems[0] as TabItem).Content) as Grid;
                if (aHost == null)
                {
                    return;
                }

                OCCViewer aViewer = Map[aHost].Viewer;
                if (aViewer != null)
                {
                    aViewer.ZoomingFinished -= new EventHandler(OnZoomingFinished);
                    aViewer.AvaliabiltyOfOperationsChanged -= new EventHandler(OnAvaliabiltyOfOperationsChanged);
                }
            }

            if (e.AddedItems.Count > 0)
            {
                Grid aHost = ((e.AddedItems[0] as TabItem).Content) as Grid;
                if (aHost == null)
                {
                    return;
                }

                OCCViewer aViewer = Map[aHost].Viewer;
                if (aViewer != null)
                {
                    aViewer.ZoomingFinished += new EventHandler(OnZoomingFinished);
                    aViewer.AvaliabiltyOfOperationsChanged += new EventHandler(OnAvaliabiltyOfOperationsChanged);
                }
            }

            AvaliabiltyOfOperationToolbarChanged();
        }