Ares
Ares

Reputation: 29

How to update wireframe without WPF button click?

I'm developing a Windows Form application with WPF User Control embedded in the WF. If I add a button and execute my userControl.DrawWireFrameCube(); My ViewPort3D get updated. I'm using Helix 3D Toolkit. But If I call my method from my MainWindowForm class it doesn't get executed and UI is not updated,but only userControl.DrawWireFrameCube(); isn't working. The other userControl.Draw3DObject(insertionPoint, points, color); method is working fine.

 private void VisualizePart(int index)
        {
            InsertionPoint insertionPoint = new InsertionPoint
            {
                X = _duplicatedListParts[index].INFO1,
                Y = _duplicatedListParts[index].INFO2,
                Z = _duplicatedListParts[index].INFO3
            };

            DetailSize points = new DetailSize
            {
                Length = _duplicatedListParts[index].LENGTH,
                Width = _duplicatedListParts[index].WIDTH,
                Thickness = _duplicatedListParts[index].THICKNESS
            };
            userControl.Dispatcher.Invoke(() =>
            {
                System.Windows.Media.Color color = System.Windows.Media.Color.FromRgb(255, 90, 0);
                userControl.Draw3DObject(insertionPoint, points, color);
                userControl.DrawWireFrameCube();
            });
        }

The difference is that in my Draw3DObject() I add items to Model3DGroup and in DrawWireFrameCube() I add items to MyViewPort3D. I'm not using XAML and I want to stay that way. Any ideas what is wrong here?

P.S I love negative vote without explanation :)

Upvotes: 1

Views: 157

Answers (1)

L Chougrani
L Chougrani

Reputation: 726

Helix is a nice tool that i've used for a while. Frankly i switch to OpenGL for this kind of reason (wireframe/etc...)

  • Helix does not give you access to shaders -> meaning you need to have two meshes (one for the model, one for its wireframe)

This is both memory consuming (2 meshes) and time consuming when modifying the mesh (2 meshes again). Using shaders you can have 1 mesh with two shaders (one for "classic" rendering and another for wireframe). then the magic happens on the GPU and is blazzing fast. modifying the mesh is directly affecting its wireframe as you have one mesh for both... it is a bit of an effort, but it is worth while. Helix and WPF (unless using XNA) is just for display purposes (and switching to XAN is as much of an effort as swithcing to OpenGL)

Upvotes: 0

Related Questions